How to Connect TradingView Alerts to WEEX with AlgoWay Webhook Automation

How to connect TradingView to WEEX with AlgoWay webhook automation

This guide shows how to connect TradingView alerts to WEEX through AlgoWay. The setup uses a regular WEEX API key with Futures trading permission, an AlgoWay WEEX webhook, and a TradingView alert containing valid AlgoWay JSON.

You do not need to build or host your own WEEX trading bot. TradingView generates the signal, AlgoWay receives the webhook and applies the selected trading logic, and WEEX executes the order on the connected Futures account.

The basic route is:

TradingView alert -> AlgoWay webhook -> WEEX Futures account

This manual covers the complete setup: creating the WEEX API key, securing it with the AlgoWay server IP, creating the webhook from the AlgoWay Store, configuring the connection, finding the webhook and JSON examples in Trade Webhooks, creating the TradingView alert, and choosing between Hedge, Reverse, Opposite and Inverse execution modes.

Before You Start

Prepare the following before creating the connection:

  • an active WEEX account;
  • access to WEEX API Management;
  • email verification and Google Authenticator or another security method required by your WEEX account;
  • an AlgoWay account;
  • a TradingView strategy, indicator, or alert condition;
  • the AlgoWay server IP shown in your dashboard for the WEEX API allowlist.

The current AlgoWay WEEX integration is for Futures/Perpetual trading. For this connection, enable the WEEX Futures trading permission. Spot permission is not required for the AlgoWay WEEX Futures route.

Step 1. Open WEEX API Management and Create a New API

Log in to the WEEX website and open Account >> API Management. Click Create new API.

For the AlgoWay connection, fill in the API form as follows:

  • Label: use a clear name such as algoway;
  • Passphrase: create and save your own passphrase;
  • Read: keep the default read permission enabled;
  • Trade futures: enable Futures trading permission;
  • Trade spot: not required for the current AlgoWay WEEX Futures integration;
  • IP address: enter the AlgoWay server IP shown in your AlgoWay dashboard.

WEEX recommends binding an IP allowlist to API keys. In the screenshots below, the AlgoWay server IP is 103.241.67.174. Always use the IP currently displayed in your own AlgoWay dashboard in case the infrastructure changes later.

Important: WEEX recommends using an alphanumeric passphrase without special characters. Save the passphrase exactly as entered. If you lose it, WEEX does not provide a way to recover it and you will need to create a new API key.

Create a WEEX API key for AlgoWay with Futures trading permission and IP allowlist

Step 2. Complete WEEX Security Verification

After the API settings are filled in, WEEX asks you to complete the account security verification. Depending on your security setup, this can include an email verification code and Google Authenticator code.

Enter the requested verification codes and click Save.

WEEX API email verification and Google Authenticator confirmation

If WEEX refuses API access because the account does not have the required security method attached, enable mobile verification or Google Authenticator in WEEX Security settings and try again.

Step 3. Save the WEEX API Key, Secret Key and Passphrase

When the API is created, WEEX displays the new API key and Secret key. Save them immediately together with the Passphrase you entered in Step 1.

AlgoWay needs all three values:

  • API Key
  • API Secret
  • Passphrase

The Secret key is shown only when the API is created. If you close the window without saving it, create a new WEEX API key.

WEEX API key and secret key created for AlgoWay

Step 4. Create the TradingView to WEEX Webhook from the AlgoWay Store

AlgoWay now has a Store page where you can create the connection directly.

  1. Open Store in AlgoWay.
  2. Under Source - From, select TradingView.
  3. Under Destination - To, select WEEX.
  4. Choose Start Trial or Buy Webhook.

After the webhook is created, the connection appears in the left-side Trade Webhooks section of the AlgoWay dashboard.

Create a TradingView to WEEX webhook from the AlgoWay Store

Step 5. Configure the WEEX Connection in AlgoWay

Open the new WEEX webhook and fill in the connection settings.

Main WEEX fields:

  • Source: TradingView
  • Platform: WEEX
  • Quantity Multiplier: Absolute for normal direct quantity routing
  • Market Type: Futures/Perpetual
  • Margin Mode: Cross or Isolated
  • Leverage: any positive integer supported by the selected WEEX contract
  • Trade Type: Hedge, Reverse, Opposite or Inverse
  • API Key: paste the WEEX API key
  • API Secret: paste the WEEX Secret key
  • Passphrase: enter exactly the same passphrase used when the WEEX API was created
  • Symbol Mapping: optional, used when a TradingView ticker needs to be translated to a different WEEX symbol

The Margin Mode selected here is used by the WEEX connection. You do not need to send Cross or Isolated in every TradingView JSON message.

The Leverage saved here is the default leverage. A different leverage can also be sent in a specific TradingView alert when needed.

Configure WEEX API key secret passphrase leverage and trading mode in AlgoWay

Step 6. Find the WEEX Webhook and JSON Examples in Trade Webhooks

After the connection is saved, open Trade Webhooks from the AlgoWay left menu.

Your WEEX row contains the unique webhook UUID used by TradingView. Click the webhook entry to copy the URL when needed. The WEEX webhook page also provides JSON examples that you can use as a starting point for TradingView alerts.

WEEX webhook in the AlgoWay Trade Webhooks dashboard

Step 7. Create the TradingView Alert Message

If you use a TradingView strategy, open the alert and place a valid AlgoWay JSON message in the Message field.

A basic WEEX strategy alert can use TradingView placeholders:

{"platform_name":"weex","ticker":"{{ticker}}","order_contracts":"{{strategy.order.contracts}}","order_action":"{{strategy.market_position}}","price":"{{close}}"}

TradingView replaces the placeholders when the alert fires:

  • {{ticker}} - chart ticker;
  • {{strategy.order.contracts}} - strategy order size;
  • {{strategy.market_position}} - strategy direction;
  • {{close}} - current close price.

You can also include trade_type directly in the JSON. When it is present, that signal uses the specified mode.

TradingView WEEX strategy alert JSON for AlgoWay

Step 8. Add the AlgoWay Webhook URL to TradingView

In the TradingView alert window, open Notifications, enable Webhook URL, and paste the unique AlgoWay WEEX webhook URL from Trade Webhooks.

Click Apply and save the alert. When the TradingView condition triggers, TradingView sends the JSON message to AlgoWay and AlgoWay routes the command to the connected WEEX account.

Paste the AlgoWay WEEX webhook URL into TradingView notifications

WEEX Trading Modes in AlgoWay

The WEEX integration supports four trading modes: Hedge, Reverse, Opposite and Inverse. All four use the same webhook. The mode can be selected in the WEEX connection settings and can also be passed directly in JSON with trade_type.

Hedge Mode

Hedge keeps LONG and SHORT positions independent. A buy signal opens or increases LONG. A sell signal opens or increases SHORT.

Open or increase LONG:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge"}

Open or increase SHORT:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"sell","trade_type":"hedge"}

To close a specific side in Hedge mode, use flat together with close_side.

Close 1 contract from LONG:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":1,"order_action":"flat","trade_type":"hedge","close_side":"long"}

Close 50% of the current LONG position:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":50,"order_action":"flat","trade_type":"hedge","close_side":"long","order_size_type":"position_percent"}

Reverse Mode

Reverse uses netting logic. An opposite signal first reduces the existing position. If the new size is equal to the current position, the position is closed. If the new size is larger, AlgoWay closes the old position and opens the remaining difference in the new direction.

Example: LONG 3 is open and SELL 2 arrives:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"sell","trade_type":"reverse"}

The result is LONG 1.

If LONG 3 is open and SELL 5 arrives:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":5,"order_action":"sell","trade_type":"reverse"}

The LONG 3 is closed and SHORT 2 is opened.

Opposite Mode

Opposite fully closes the current position and then opens a new position using exactly the size of the new signal. The size of the existing position does not change the size of the new entry.

Example:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"opposite"}

If the next signal is:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":1,"order_action":"sell","trade_type":"opposite"}

AlgoWay fully closes the existing position and opens SHORT 1.

flat is not used with Opposite mode. For a complete close, use closeall.

Inverse Mode

Inverse reverses the direction of the incoming signal first and then applies Reverse logic.

buy >> executed as sell

sell >> executed as buy

This signal:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"inverse"}

opens SHORT 2 from a flat state.

This signal:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"sell","trade_type":"inverse"}

opens LONG 2 from a flat state.

flat and closeall are not inverted.

Close All WEEX Positions for a Symbol

To fully close all open positions for the specified symbol and remove its pending orders, use closeall:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":0,"order_action":"closeall","trade_type":"hedge"}

closeall does not depend on order_contracts. The trading mode does not change the close-all operation.

Buy / Sell and Long / Short

WEEX alerts can use either buy / sell or long / short.

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"long","trade_type":"hedge"}

Market Orders with Stop Loss and Take Profit

If order_type is not specified, the signal uses normal market execution.

Absolute Stop Loss and Take Profit prices:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","sl_price":0.105,"tp_price":0.13}

Stop Loss and Take Profit in percent:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","stop_loss":1,"take_profit":2,"sltp_type":"percent"}

Stop Loss and Take Profit in pips:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","stop_loss":100,"take_profit":200,"sltp_type":"pips"}

WEEX Limit Orders

For a Limit order, set order_type to limit. The price field is required.

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","order_type":"limit","price":0.09}

A Limit order can also include Stop Loss and Take Profit:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","order_type":"limit","price":0.09,"stop_loss":1,"take_profit":2,"sltp_type":"percent"}

WEEX Stop Entry Orders

For a conditional Stop entry, set order_type to stop. The price field is required.

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","order_type":"stop","price":0.14}

Position Size as a Percentage of Account Equity

With order_size_type set to balance_percent, order_contracts becomes a percentage of account equity.

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":1,"order_action":"buy","trade_type":"hedge","order_size_type":"balance_percent"}

In this example, 1 means 1% of account equity.

Risk-Based Position Sizing

With order_size_type set to risk_percent, AlgoWay calculates the position size from the selected percentage of equity and the distance to the Stop Loss.

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":0.5,"order_action":"buy","trade_type":"hedge","order_size_type":"risk_percent","stop_loss":2,"sltp_type":"percent"}

Here, 0.5 means a target risk of 0.5% of equity with a Stop Loss 2% away.

Leverage

The leverage saved in the WEEX connection is used by default. You can override it for a specific signal by adding leverage:

{"platform_name":"weex","ticker":"ARBUSDT.P","order_contracts":2,"order_action":"buy","trade_type":"hedge","leverage":5}

If leverage is not present in the alert, AlgoWay uses the leverage configured in the WEEX webhook.

Cross and Isolated Margin

Choose Cross or Isolated in the WEEX connection settings. You do not need to send mgn_mode in TradingView JSON.

AlgoWay checks the current WEEX margin configuration and applies the webhook setting when possible. If changing the margin configuration would be unsafe because the symbol already has an open position or pending order, the operation is blocked instead of forcing a risky account-mode change.

Trailing Stop

Trailing Stop is currently not available for the WEEX integration.

Do not add trailing_pips to WEEX alerts. A WEEX signal containing this parameter is rejected instead of being silently emulated by AlgoWay.

Supported WEEX Automation Features

The current AlgoWay WEEX connection supports:

  • Market orders;
  • Limit orders;
  • Stop entry orders;
  • Stop Loss and Take Profit;
  • absolute-price SL/TP;
  • percentage SL/TP;
  • pips-based SL/TP;
  • per-signal leverage;
  • balance-percent position sizing;
  • risk-percent position sizing;
  • position-percent closing;
  • Hedge mode;
  • Reverse mode;
  • Opposite mode;
  • Inverse mode;
  • Close All.

Symbol Mapping

If the ticker sent by TradingView is different from the symbol expected by WEEX, use the optional Symbol Mapping field in the WEEX webhook.

Example:

BTCUSDT.P:BTCUSDT

This lets the TradingView alert keep using its chart ticker while AlgoWay sends the mapped symbol to WEEX.

Common WEEX Connection Problems

API Key, Secret or Passphrase Is Incorrect

All three values must belong to the same WEEX API key. The Passphrase is case-sensitive and must match the value entered during API creation.

Futures Permission Is Missing

A read-only API key cannot place Futures orders. Edit or recreate the API key with Trade futures permission enabled.

AlgoWay IP Is Missing from the WEEX Allowlist

If the API key is restricted by IP, the AlgoWay server IP shown in your dashboard must be included in the WEEX API configuration.

The API Was Just Created or Modified

WEEX notes that newly created or modified API keys may need some time before the updated permissions are available across the platform. If the settings are correct but the first request is rejected, wait a short time and test again.

TradingView JSON Is Invalid

The alert message must be valid JSON. Use double quotes and make sure the commas and brackets are correct.

Wrong Trading Mode

Check the trade_type in the alert and the default Trade Type selected in the WEEX webhook. Hedge, Reverse, Opposite and Inverse intentionally produce different behavior when an opposite signal arrives.

Limit or Stop Order Has No Price

Both limit and stop entry orders require the price field.

Trailing Stop Was Added

Trailing Stop is not currently supported for WEEX. Remove trailing_pips from the alert.

Related AlgoWay Guides

Key Takeaway

To connect TradingView to WEEX, create a WEEX API key with Futures trading permission, bind the AlgoWay server IP, save the API Key, Secret Key and Passphrase, create the TradingView-to-WEEX webhook from the AlgoWay Store, configure the WEEX connection, and paste the webhook URL and JSON message into TradingView.

One WEEX webhook can handle Hedge, Reverse, Opposite and Inverse trading logic, together with Market, Limit, Stop entry, SL/TP, leverage and percentage-based position sizing.