Guide to setting up a trading strategy TradeINEX AI Strategy. How to set up and use automated trading with a webhook based on TradingView strategy signals on the Bybit or Binance exchanges.
Interface Of Strategy
Settings On TradingView
Setup on Exchange
After payment, we will connect indicators to your TradingView account within 24 hours (usually 1-2 hours).
If you don't have a TradingView account yet, register one on the website or mobile app.
Installation on PC
1. Press the button “Indicators” to open the menu “Indicators, Metrics & Strategies”.
2. Go to the section “Invite-only scripts”. If you haven't used invite-only scripts before, sometimes you need to reload TradingView site for this section to appear.
3. Select indicator TradeINEX: AI Strategy.
Installation on a mobile device
1. Press the button “+” to open the menu “Add”.
2. Press the button “Indicators” to open the menu “Indicators, Metrics & Strategies”.
3. Go to the section “Invite-only scripts”. If you haven't used invite-only scripts before, sometimes you need to reload the TradingView app for this section to appear.
4. Select indicator TradeINEX: AI Strategy.
INTERFACE OF STRATEGY
Elements of the indicator interface on the chart:
1. BUY / SELL Signal - signals to initiate trade on the exchange following the signal direction.
2. Stop Loss - initial stop loss level for your trading position. A stop-loss is a price level where you will close your trade for a loss in order to avoid irreparable damage to your portfolio.
3. Trailing Stop - dynamic stop loss level which will move as the market moves in a favorable direction.
4. Take-profit (TP1-4) - these levels are price targets that you set in advance to lock in and bank profits from a successful trade.
5. Statistics - internal AI statistics.
6. Orders - the orders that the strategy creates for opening and closing positions, partial profit-taking, and stop-loss. The numbers indicate the quantity of contracts in each order.
7. Net Profit - net profit or loss from the trading strategy, which takes into account all profitable and losing trades over the entire period.
8. Total Closed Trades - the total number of all closed trading transactions over the entire period.
9. Percent Profitable - the percentage of profitable trades over the entire period of the strategy's operation.
10. Profit Factor - the amount of money the strategy made for every unit of money the strategy lost, gross profit divided by gross losses.
11. Max Drawdown - total loss from all losing trades over the entire period of the strategy's operation.
12. Avg Trade - net profit divided by overall numbers of closed trades.
13. Avg Bars in Trade - the average number of bars elapsed during trades for all closed trades.
SETTINGS ON TRADINGVIEW
The operation of the trading algorithm in the strategy is practically no different from the operation of the indicator's algorithms. Therefore, we will not cover all the settings here. For full configuration of the trading algorithms, you can use our detailed guide on setting up the TradeINEX AI Signals indicator: https://www.tradeinex.net/post/user-manual-tradeinex-signals
Here, we will only show the settings of functions that are not present in the indicator or are different in the strategy.
ATTENTION: For the correct execution of all orders on the exchange based on our strategy's signals, it is crucial that the strategy's parameters match the exchange's parameters!
For trading derivatives (including perpetual contracts, inverse contracts, and futures contracts), the exchange uses conditional units of measurement - contracts (CNT). The size of one contract is equivalent to the size of one unit of the base currency of the trading pair. Therefore, the size of 1 contract for the trading pair BTC/USDT with collateral in USDT = 1 BTC.
EXAMPLE: With a Bitcoin price of $25,000, for the trading pair BTC/USDT, 1 contract would be equal to 1 BTC or 25,000 USDT. To open a position of 50 USDT, you would need to place an order for 0.002 contracts.
FORMULA: Position size in contracts = Position size in $ / Cost of 1 unit of the base asset in $.
Position sizes in different units of measurement are displayed in the table in the STRATEGY section:
1st row - the current position size in contracts.
2nd row - the current position size in USD or another quote currency.
3rd row - the initial position size in contracts.
4th row - the current cost of one contract in USD or another quote currency.
Open the tab - Inputs and setup all the important parameters of strategy:
Please note that the exchange has a minimum order size requirement, which varies for different trading pairs. For example, for the BTC/USDT pair, the minimum allowable order size in contracts is 0.001 (3 decimal places), while for the LTC/USDT pair, it is 0.1 (1 decimal place). Orders with sizes smaller than the allowed minimum will not be executed.
Therefore, the strategy rounds fractional numbers to the required precision. The "Rounding" parameter must match the maximum allowable number of decimal places for contracts of the selected trading pair on the exchange. Otherwise, the strategy's commands may be executed incorrectly!
Choose the method for specifying the position size. Keep in mind that the strategy's order sizes on the chart will always be displayed in contracts.
USD (Quote Currency) - For user convenience, position sizes will be set in USD or any other quote currency of the trading pair. When sending commands to the exchange, the strategy will automatically convert the order size into contracts. For example, for the BTC/USDT trading pair, 1 contract equals the price of 1 BTC in the equivalent of USDT.
Contracts (Base Currency) - Position sizes will be set directly in contracts without conversion, meaning in the base currency of the trading pair. For example, for the BTC/USDT trading pair, 1 contract equals 1 BTC.
Percent % - Position sizes will be calculated as a percentage of the deposit in USD or another quote currency. The deposit size is set in the Strategy Properties tab.
Position Amount (Order Size)
Set the order size for opening positions based on the signals of the strategy for both buy and sell. The order size should correspond to the planned position size on the exchange, without taking into account leverage. If the size is specified in USD, the strategy will automatically convert the order size into contracts when sending commands to the exchange. On the chart, order sizes are displayed in contracts.
This parameter should be equal to the leverage set on the exchange. When a buy or sell signal is generated by the strategy, a position will be opened on the exchange with a size = Position Amount * Leverage.
This parameter sets the commission size for opening and closing positions as a percentage of the position size. It only affects the built-in strategy statistics. To set the commission in the Strategy Tester, configure the appropriate parameters in the Strategy Properties tab. Use this parameter only for testing the strategy on TradingView and not for automated trading on the exchange.
Type Of Position
Choose whether the initial position size will be fixed for each signal or calculated based on specific strategies:
Fixed (recommended) - The initial position size when opening positions based on the strategy's signals will always be the same.
Progressive - The initial position size will be adjusted based on the profit or loss from the previous trade.
Martingale - The initial position size will be doubled following a Martingale strategy if the previous trade incurred a loss.
Choose the method of managing an open position for loking profits at take-profit levels:
Limit - In this mode, profits will be taken using limit orders at the take-profit levels before the bars close.
Market - In this mode, profits will be taken using market orders at the closing levels of the bars.
STRATEGY TESTER SETTINGS
Click on the gear icon to open the settings window.
Go to the - Properties tab.
You can adjust these parameters for backtesting purposes on TradingView only.
However, before running the strategy on the exchange, make sure that all parameters are set to their default values. The strategy will automatically manage all the necessary parameters. Changing these settings can lead to incorrect execution of strategy commands on the exchange!
SETUP ON EXCHANGE
Automating trading on BuyBit or Binance exchange using our trading strategy is only possible for trading derivatives, including perpetual contracts, inverse perpetual contracts, and futures contracts.
For each trading pair, you need to create and connect a separate trading strategy with the corresponding settings and charts.
The transmission of signals to the exchange is carried out through webhook notifications. To use webhooks, a paid TradingView subscription is required.
IMPORTANT: The trading pair and timeframe on the exchange must match the trading pair and timeframe you are using in the strategy on the TradingView chart.
IMPORTANT: You should select a one-way position mode since hedge mode is not supported for automated trading.
Please note that there may be delays in order execution in case of unstable data transmission speed between TradingView and the exchange. The exchange may not correctly execute some orders due to a lack of liquidity, high volatility, additional commission charges, or other technical reasons. Therefore, the trading statistics in the Strategy Tester on TradingView and the statistics of real trading may differ!
REGISTRATION ON BUYBIT
To begin automated trading using our strategy on the BuyBit exchange, please follow these steps:
Register on the BuyBit exchange using this link: https://www.bybit.com/invite?ref=JZ5NLW
or use this referral code: JZ5NLW
Complete the KYC level 1 verification process on the BuyBit exchange.
Deposit a minimum of 100 USDT into your BuyBit account.
Once you have completed these steps, you can proceed with setting up and using our trading strategy on the BuyBit exchange for automated trading.
REGISTRATION ON BINANCE
To begin automated trading using our strategy on the Binance exchange, please follow these steps:
Register on the Binance exchange using this link: https://www.binance.com/en/activity/referral-entry/CPA?ref=CPA_003HQ25XGT
or use this referral code: CPA_003HQ25XGT
Deposit more than 50 USDT into your Binance account.
Once you have completed these steps, you can proceed with setting up and using our trading strategy on the Binance exchange for automated trading.
WHAT IS A WEBHOOK?
Webhook - is a way to notify about events that occur within a system using custom HTTP callbacks.
In TradingView, webhooks are used to send signals or notifications to other trading platforms, such as trading bots or directly to exchanges. They provide the capability to trigger actions in response to specific events on a TradingView chart but do not have direct feedback mechanisms or built-in capabilities for executing trades or placing orders on an exchange. Therefore, when an exchange receives a webhook signal, it executes a market order.
Please DO NOT share your webhook URL with others, as this may allow you to receive false/scam messages or false orders placed from others.
CREATING A WEBHOOK ON BUYBIT EXCHANGE
Enter the page of the contract you would like to trade under the Derivatives tab, click on Tools in the order zone, and then select Webhook Signal Trading.
Click on Create Now and click on I’ve confirmed the above.
Follow these steps to set up your webhook:
Select Symbol - choose your desired symbol for Webhook Trading. Please ensure that this note corresponds to the symbol you are using for the strategy on TradingView.
Position Mode: One-Way Mode. Ensure that the position mode for the symbol you are executing the strategy for is set to One-way mode, as automatic trading for the Hedge position mode is not supported.
Signal Name - enter your signal name for your TradingView strategy.
Then, click on Create Webhook.
CREATE ALERT ON TRADINGVIEW
To create an alert for your strategy, open the Strategy Tester and click on the alarm clock icon, which represents - Add alert.
CONNECT THE WEBHOOK TO THE STRATEGY
Copy the message template from the Bybit or Binance page and paste it to the message box in the alert settings tab on TradingView.
Copy the Webhook URL from the Bybit page and paste it to the URL in the alert notification tab.
Click on Run the webhook.
SYNCHRONIZING STRATEGY WITH THE EXCHANGE
IMPORTANT: Right after launching the webhook, you need to perform a one-time action to synchronize the position on the exchange with the position in the TradingView strategy.
Why is this important? When you initially start the webhook, there won't be any open positions on the exchange until the first signal is received from the strategy. However, there might already be an open position on the TradingView chart due to a previous strategy signal that appeared before launching the exchange's webhook. In this case, you need to manually open the first position on the exchange, in the same direction and with the same size as the current open position in the TradingView strategy. To do this, follow these steps in the Trading tab:
Set the order type to Market.
Set the position size in USDT to match the size of the open position in the TradingView strategy. This size is displayed on the chart next to the last price and in the table. Ensure that the number of contract contracts for the order on the chart and on the exchange also match.
IMPORTANT: Strategy data is updated once per bar. In 'Position Management - Market' mode, if a candle touches the TP level only with its wick but not with its body closure, sometimes the data on the TradingView chart may update only after that TP level is reached with the candle's body closure. This behavior is typical for small timeframes, such as 1 minute (1M).
Click BUY or SELL according to the direction of the current strategy signal.
Make sure that the number of contracts in the new positions created by the strategy signals matches the number of contracts on the TradingView chart. If they match, it means that the setup and synchronization have been done correctly.
CONGRATULATIONS! Your strategy is now synchronized and fully prepared for autonomous trading on exchange. From now on, the strategy will automatically open and close positions based on buy and sell signals and will also take profit in accordance with your trading strategy.
WEBHOOK SIGNALS STATISTICS
To view the specific details of the Webhook Signal, please go to the Tools tab, and then select Webhook. Here, you can view the Signal Name, Triggered / TradeTime, Realized P&L, and Time Created.
To view more of your Signal Details, click on the Details button beside and you can review your Webhook URL and Message Template. Also, you will be able to see the executed trade via this strategy.
PAUSE OR TERMINATION THE WEBHOOK
Manual Termination or Pause: To manually terminate a webhook signal, navigate to the Tools Tab. Find the signal initiated by the webhook you wish to close and click on Terminate. If you want to temporarily stop the strategy, click on Pause instead.
ATTENTION: After deleting the webhook, the opened position will not be closed automatically. You will need to close it manually!
Auto Termination: A webhook signal may be automatically terminated due to several reasons:
- If 10 consecutive order failures occur, the strategy will be terminated.
- If the contract type selected is not supported on TradingView.
- Incomplete set parameters can lead to automatic termination.
- If an unsupported position mode (Hedge Mode) is selected.
- If the selected Futures contract is nearing its delivery date.
- If your account is being upgraded to a Unified Trading Account.
- You have reached the maximum number of Webhook Strategy can be created. Each symbol can have 5 Webhook strategies running simultaneously while each UID can have a maximum of 10 webhook strategies running at the same time.
- Your account is restricted.
TO NEW USERS: If you have never traded derivatives before, practice creating orders manually before starting automated derivative trading.
DO NOT TRADE YOUR ENTIRE DEPOSIT! The recommended margin size for one position should not exceed 10% of your total deposit.
USE ISOLATED MARGIN ONLY! In isolated margin mode, you risk only a certain amount of margin for one position. In cross-margin mode, your entire margin account balance is used as collateral, which you can lose in the event of position liquidation. This can happen due to significant price slippage through the stop-loss or trailing stop level before the candle closes or due to a lack of liquidity on the exchange.
USE STOP ORDERS! This is a reliable way to close losing positions in a timely manner and protect your deposit from unplanned losses.
TAKE PROFITS IN PORTIONS! This will allow you to remain in profit even in the event of a sudden price reversal against the signal.
ATTENTION: In case of changes to the strategy parameters, you need to recreate the alert and webhook on the exchange.
Answers to frequently asked questions and solutions to technical problems.
Why are the signals from my strategy not being executed on the exchange?
The BuyBit exchange may not execute your strategy's commands for the following common reasons:
1. The number of contracts in the order created by the strategy's signal is less than the minimum allowable order size on the exchange.
2. The initial position size on BuyBit was not synchronized with the strategy's position size after launching the web hook.
3. There are insufficient funds in your account balance to create an order.
4. You have changed the strategy's parameters on TradingView after creating the alert and web hook.
5. The parameters of the strategy or web hook were initially set incorrectly or incompletely.
6. There was a delay in transmitting the signal from TradingView to the exchange.
Why has the operation of webhook signals been stopped?
The operation of web hook signals can be automatically stopped for several reasons:
1. There have been 10 consecutive order execution failures.
2. The contract type on the BuyBit exchange is not supported on TradingView.
3. The parameters of the strategy or web hook were initially set incorrectly or incompletely.
4. An unsupported position hedging mode was selected.
5. The maximum number of available web hook strategies has been exceeded.
Why do the P&L in the details of web hook signals not match the realized profit/loss on my account?
1. The realized P&L displayed in the details of Web Hook Instruments represents only the P&L of the position realized as a result of trades executed by the web hook strategy. It does not include trading commissions and funding fees.
2. Profit and loss from manual trading, including the initial position you opened for synchronization with the strategy, are also not included.
Why don't the statistics in the strategy tester and on the exchange match?
1. There can be delays in order execution due to unstable data transmission speed between TradingView and the exchange. The exchange may not execute certain orders correctly due to a lack of liquidity, high volatility, additional fees, or other technical reasons.
2. The realized P&L displayed in the details of Web Hook Instruments represents only the P&L of the position realized as a result of trades executed by the web hook strategy. It does not include trading commissions and funding fees.
3. Profit and loss from manual trading, including the initial position you opened for synchronization with the strategy, are also not included.
Why don't the internal indicator statistics and the strategy tester statistics match?
1. The calculation of indicator statistics and strategy tester statistics occurs using completely different algorithms. The indicator calculates statistics only based on the results of signals, where each signal represents a set of all trades during its period of validity. The strategy calculates statistics based on all trades, regardless of which signal they were part of. This is why you may see a much higher number of trades in the strategy tester.
2. Additionally, the strategy can only place orders based on the indicator's command at the close of a candle. Therefore, when closing a position due to a trailing stop or a reversal signal, the calculation uses the price at the moment of the current candle's close, not the actual price as in the indicator.