9911939149 support@algoji.com

Supertrend strategy automation with free TradingView

Reference: Do I need Free or Paid version in TradingView?

You can automate complete strategies, and not just indicators using the TradingView free version. That’s right! explore 1000s of strategies from public library using free tradingview and free apibridge (paper trading) 🙂 We will demonstrate this using SuperTrend strategy (not supertrend indicator).

The TradingView free plan allows to run max 2 alerts at same time, which are sufficient to automate one strategy. To demonstrate, we will pick the “Super Trend 2 MACD” strategy from public library. This strategy uses both ST and MACD.

STEP 1: Click on Indicators and search for “Super Trend 2 MACD”. You can customize any strategy which is public mode (the pinescript should be editable)

STEP 2: Click on source code. You need to make copy of that code before customizing it for automation. Click on make copy and save it

STEP 3: Add alerts in code for automating this strategy. Add these lines at bottom of code:

strategy.entry("Buy", strategy.long,when=golong,comment="TYPE:LE")
strategy.exit("Close Buy","Buy",profit=tp,loss=sl,comment="TYPE:LX")
strategy.entry("Sell", strategy.short,when=goshort,comment="TYPE:SE")
strategy.exit("Close Sell","Sell",profit=tp,loss=sl,comment="TYPE:SX")

STEP 4: You can now create alert on this strategy by clicking add alert option.

STEP 5: Finally copy this text in the alert message and save it. Every time you create alert in free version you makesure you pause all the running alerts as you can atmost run one alert at an instance of time. You can customize inputs of the strategy here

SYMBOl: {{ticker}}

Note: To change strategy parameters, click on settings icon