Code Library / Indicators

Supertrend Indicator

Supertrend with buy/sell signal arrows.

Language: Pine Script · Category: Indicators · Tags: Supertrend, trend, Pine Script

Source code

//@version=5
indicator("Supertrend", overlay=true)
[st, dir] = ta.supertrend(3, 10)
plot(dir<0?st:na, "Up", color.green)
plot(dir>0?st:na, "Down", color.red)

How to use this snippet

This is a building block, not a finished trading system. Paste it into your own Pine Script project, compile it, and test it on a demo account with your broker's real spreads before relying on it. You can convert it to MQL4 or MQL5 with the Pine Script converter.

Related snippets