Automating your trading strategies by connecting TradingView alerts to BingX can significantly enhance your trading efficiency. This guide provides a step-by-step approach to setting up this automation, detailing the command syntax, parameters, and supported commands to ensure seamless integration.
BingX API network allows users to automate trades based on signals from platforms like TradingView. By creating an API key, setting up a webhook, and adding trading instructions on your TradingView alerts, you can execute trades automatically when specific market conditions are met.
Command Syntax
The structure of commands used to automate trades is as follows:
[command] [symbol] [param]=[value]
Where:
- command: Specifies the action to be executed, such as ‘buy’ or ‘sell’.
- symbol: Indicates the trading pair or instrument, like ‘BTC/USDT’.
- param: Defines specific parameters for the trade, such as quantity, leverage, or stop-loss.
- value: Assigns the value to the specified parameter.
Parameters
Several parameters can be customized within commands to control trade execution:
- Q: Quantity of the asset to trade. For example, ‘Q=0.01’ for 0.01 BTC. It can also be in percentage.
- OQ & CQ: Opening Quantity and Closing Quantity used in some cases to override Q.
- L: Leverage multiplier. For example, ‘L=10’ for 10x leverage.
- P: Entry price for limit orders. Either as an actual price or as a percentage.
- SL: Stop-loss either as actual price or percentage. For example, ‘SL=5%’ sets a stop-loss at 5% below the entry price.
- TP: Take-profit either as actual price or percentage. For example, ‘TP=5%’ sets a take-profit at 5% above the entry price.
- C: Contract type, such as ‘C=FUTURES’ for perpetual futures or C=Spot for spot account.
- D: Delays the execution of a command in seconds. The maximum delay is 5 seconds. For example, D=4.
- B: Check your account balance. Either the total or the free balance.
- HEDGE: Added when the Position mode is set to Hedge Mode.
Important Notes
-
Case Sensitivity
Parameter names are not case-sensitive.QuanTity=0.5
will still work. -
Parameters Formatting
The parameters should be separated by a single space.- Correct:
Q=0.5 Quantity=0.5
- Incorrect:
Q = 0.5 Quantity = 0.5
- Correct:
-
Hedge Mode: If your BingX account is set to hedge mode, include ‘HEDGE’ in your commands to specify the position side.
-
Multi-Commands
You can include up to 5 commands in a single alert. Each command should start on a new line for clarity. Example:
balance B=Total
CLOSE BTC/USDT Q=0.05 C=FUTURES
SELL ETH/USDT Q=0.01 C=FUTURES
BUY XRP/USDT Q=10 C=SPOT
Supported Commands
The following commands are supported for automating trades:
1. Opening a Position
Required Parameters: Action and the Symbol
Optional Parameters: Q, P, TP, SL, CQ, OQ, L, D, and HEDGE
Indicator Alerts:
Buy Command
Initiates a buy (long) position.
Example:
buy BTC/USDT Q=0.01 L=10 SL=5% TP=5% C=FUTURES
This command opens a long position on BTC/USDT with 0.01 BTC at 10x leverage, a 5% stop-loss, and a 5% take-profit in the futures.
Sell Command
Initiates a sell (short) position.
Example:
sell BTC/USDT Q=0.01 L=10 SL=5% TP=5% C=FUTURES
This command opens a short position on BTC/USDT with 0.01 BTC at 10x leverage, a 5% stop-loss, and a 5% take-profit in the perpetual futures market.
2. Closing a Position
Required Parameters:
Action
(Close/Flat/0), and the Symbol
Optional Parameters: C
Example:
close BTC/USDT C=FUTURES
This command closes the open position on BTC/USDT in the futures account.
3. Cancelling a Limit Order
Required Parameters: Action (Cancel/Exit), and the Symbol
Optional Parameters: C
cancel BTC/USDT C=FUTURES
This command cancels any limit/stop orders of BTC.
4. Checking Account Balance
Required Parameters: Balance command (Balance, funds, bal)
Optional Parameters: C, Free, and Total
Example:
balance
Balance USDT B=FREE C=FUTURES
Balance USDT B=Total C=FUTURES
This command retrieves your account balance.
By following this structured approach, you can effectively automate your TradingView alerts to execute trades on BingX, enhancing your trading efficiency and strategy implementation.