Automation is very simple with all versions of the StratBuilder.
First, find a strategy you would like to automate and hook up your exchange/broker to a site that allows automation through TradingView alerts. This will cost a subscription fee to the platform.
Some examples are:
- - . Supports Binance, Bybit, Bitget, OKX, phemex, and Bitmex.
- - Crypto trading. Supports 16 different crypto exchanges: https://3commas.io/exchanges
- - Forex, stocks, and futures trading.
- Many more
1. Connect your trading exchange/broker/account to your preferred automation platform. The automation platform will have directions on how to do this.
2. Create a strategy on the StratBuilder that you want to automate.
3. Input the messages you want to occur during entry, exit, take-profit, and stop-loss in the settings of the StratBuilder:
This example is automating a BTC strategy using Alertatron. I set the take-profit and stop-loss price in the entry command so I don’t need to input any commands for when the TP or SL get hit.
3.Hover over the ‘StratBuilder’ name on the chart and click on the icon with the three dots at the very right
4. Click ‘Add alert on StratBuilder…’
5. In the ‘Message’ box, input this :
{{strategy.order.alert_message}}
6. Give it any title you want, then click on the ‘Notifications’ tab
7. Turn on the ‘Webhook URL’ option, and input the webhook URL given to you by the automation platform.
8. Click ‘Create’ in the bottom right. And that’s it, now your strategy is automated!
- ‘’ - The alert for this message will be triggered when a trade is entered.
- ‘’ - The alert for this message will be triggered when the script exits a trade upon closure (not off a take-profit or stop-loss).
- ‘’ - The alert for this message will be triggered when the script exits a trade by hitting the take-profit.
- ‘’ - The alert for this message will be triggered when the script exits a trade by hitting the stop-loss.
In the ‘StratBuilder (2-Side)’ version, there’s input for all of these for both longs and shorts, separately. So longs have their own 4 alert message inputs, and shorts have a separate 4 alert message inputs in the same indicator.
In your automation commands, you can refer to the as:
{{plot_0}}
You can refer to the as:
{{plot_1}}
There’s also an ‘Order Size’ input at the very bottom of the indicator. The number you input there will be divided by the price of the asset. This was mainly added for crypto trading. The '' can be referred to in your automation command as:
{{plot_2}}
This will enter on a market order with the dollar amount that you specify in the ‘Order Size’ input at the bottom of the StratBuilder’s settings. It also sets the take-profit and stop-loss for the strategy.
apiName(BTCUSDT) {market(side=buy, amount={{plot_2}}); stopOrder(offset=@{{plot_0}}, reduceOnly=true, position=0, tag=stop); limit(offset=@{{plot_1}}, reduceOnly=true, position=0, tag=limit_exit); } #bot
This will exit the trade and cancel all existing orders.
apiName(BTCUSDT) {cancel(which=all); market(position=0, reduceOnly=true); } #bot