Supertrend is a trend-following indicator plotted on price charts. It changes color based on trend direction and is excellent for trailing stop-losses. This V6 code allows customization of the ATR factor.
//@version=6
indicator('Supertrend', overlay=true)
factor = input.float(3.0, 'Factor')
atrPeriod = input.int(10, 'ATR Period')
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
plot(direction < 0 ? supertrend : na, 'Up Trend', color=color.green, style=plot.style_linebr)
plot(direction > 0 ? supertrend : na, 'Down Trend', color=color.red, style=plot.style_linebr)Enhance your trading workflow with these professional tools and platforms.
Keep 100% of the first $12.5K. EOD Drawdown and flexible evaluation types to suit your style.
Secure, reliable, and fully licensed. The best crypto experience for US traders.
The professional's choice for futures trading with minimal slippage and stable API.
Mirror the positions of top-tier traders instantly without writing code.