Automating trading from a TradingView Pine Script strategy
To send alerts from a strategy, use the
alert_message (opens in a new tab) parameter from Pine Script strategy functions which can generate order.
- Define the content of your alert before any
messageBuy = "EXCHANGE=binance\nSYMBOL=SOLUSDT\nVOLUME=100a%\nSIGNAL=BUY"
Note: when defining your alert, don't forget to add
\nat the end of each value. This simulates a return to the next line to comply with to the Octobot alert format.
- In the strategy section, add
alert_message = messageBuyto your strategy
strategy.entry("Buy", strategy.long, comment = "Buy Signal Triggered", alert_message = messageBuy)
- When creating a new alert (right-click on the strategy / add new alert) make sure that you:
- Select the name of your strategy as the condition
- Name the alert (the name can be whatever you want)
- Replace ALL the message content with exactly
- Et voilà ! This alert will automatically notify your OctoBot each time your strategy executes
- For multi-coin, simply edit the strategy and modify the SYMBOL entry in the messageBuy definition. You can thus vary the parameters according to the assets.
- It can be easier to define multiple messages such as
messageCanceland use the appropriate message later on (with the
alert_messageparameter) when calling
Special thanks to @KidCharlemagne for creating the basis of this guide !
Learn more about how to create your TradingView alerts on the TradingView alert format guide.
Wondering how to make your OctoBot listen to TradingView signals ? Checkout our TradingView integration guide.