OPEN-SOURCE SCRIPT

MTF Trend Example

130
//version=6
indicator("MTF Trend Example", overlay=true)

emaFast = ta.ema(close, 20)
emaSlow = ta.ema(close, 50)

trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow

plot(emaFast)
plot(emaSlow)
barcolor(trendUp ? color.green : trendDown ? color.red : na)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.