You can use TradingView signals as a condition for starting and stopping the bot.
1. TradingView signal as a condition for starting a bot
2. Create a signal on the TradingView platform
3. Switching a bot's trading pair upon receiving a TradingView signal
4. TradingView signal as a condition for stopping a bot
Please note that you will need a paid PRO subscription on the Tradingview platform (at the time of writing this article is $14.95).
The launched bot will wait for a signal from the TradingView platform to start trading before the first start of trading and before the start of each new cycle.
For this purpose it is necessary to activate the checkbox «Enable bot work by signals Tradingview» when you create/edit bot in the menu «Signals Tradingview» and then save bot.
This menu contains information that will be useful when creating signals on TradingView
This menu contains information that will be useful when creating signals on TradingView, this is
You need to log on to the Tradingview platform, open a chart of the desired trading pair and select the desired indicator.
Then click on the clock icon.
The Signal Creation menu will open. Then click to create an alert:
Configure the alert by selecting the trigger condition, parameters, and name. Note that warnings can be one-time and repetitive. A one-off will work only once. If you want to repeat the signal to the bot, choose the repeated type of weighting (for example «once per bar»)
In the notification actions, activate the web Hook URL checkbox and insert the link from the "Signal URL" field that is displayed in the bot settings.
In the alert message, paste the text from the «Message for Signal» field.
Next, you need to click the create button, after which the alert will appear in the alert list.
When the alert condition is triggered, the signal will be sent via a web-hook to the bot, and it will start trading.
IMPORTANT! If, in addition to the Tradingview signal, the bot is given filters to start, they must also be passed in order for the bot to start a new cycle.
You can create multiple signals on the TradingView platform for different trading pairs and use these signals in one bot with the LONG algorithm.
The bot will switch the trading pair based on the information about the pair from the incoming signal.
In order for the bot to switch a trading pair when a signal is received, when creating a signal on TradingView, add information about the pair in the signal message (which you copy from the bot editing menu).
Below is an example of a signal message without specifying a trading pair and specifying a trading pair:
Signal message without specifying a trading pair:
{
"bot_id": 100279,
"ref_token": "982d2195-61c0-11e8-aa40-80418d442871",
"action": "enter_cycle"
}
Signal message indicating a trading pair:
{
"bot_id": 100279,
"ref_token": "982d2195-61c0-11e8-aa40-80418d442871",
"action": "enter_cycle",
"pair": "link/usdt"
}
The correctness of the signal message format after adding the pair parameter can be checked here https://jsonlint.com/
Please note that if a trading pair entered in a signal does not fit the bot, then such a signal will be ignored.
The bot's wallet (deposit) must be suitable for all trading pairs for which the bot will receive signals.
Switching a pair is impossible if a bot with the SHORT algorithm is used, since changing a pair requires changing the bot's wallet to a new coin.
You can use the TradingView signal as a condition for the bot to stop.
The bot will be stopped using the Stop-Loss mechanism.
When TradingView receives a signal, the bot will cancel all active cycle orders and send a market order to close the open position to the exchange.
To activate this function, you need to enable the filter "Stop-Loss: Execute stop-loss on the signal" in the bot filters.
The launched bot will wait for the TradingView signal, upon receipt of which the Stop-Loss mechanism will be launched, the current cycle will be closed, and the bot will start a new cycle.
If you want the bot not to start a new cycle after the TradingView receives a stop signal, you need to enable the "Stop-Loss: Stop the bot on execution" filter.
The message for the signal to stop the bot must be copied from the bot editing menu, and stoploss must be specified in the action field.
An example of a signal to stop a bot:
{
"action" : "stoploss",
"bot_id" : 242047,
"ref_token" : "982d2195-61c0-11e8-aa40-80418s442871"
}
Important!
Stopping a bot based on a TradingView signal can work:
Separately from the start of the bot by the TradingView signal (the bot does not use the start by the TradingView signal).
If the bot should not use the mechanism for starting a bot by a TradingView signal, then in the bot editing menu, deactivate the checkbox for the bot to work on a TradingView signal and save the bot settings.
Together with the start of the bot by the TradingView signal (the bot uses the start by the TradingView signal).
If the bot uses the mechanism for launching a bot based on a TradingView signal, then in the bot editing menu, the checkbox for the bot's operation on a TradingView signal must be activated, and the bot settings are saved.