Ready-to-use Pine Script v5 templates for TradingView. Copy and customize.
//@version=5
indicator("SMA Crossover", overlay=true)
fast = ta.sma(close, 9)
slow = ta.sma(close, 21)
plot(fast, "Fast SMA", color.blue)
plot(slow, "Slow SMA", color.orange)
buySignal = ta.crossover(fast, slow)
sellSignal = ta.crossunder(fast, slow)
plotshape(buySignal, "Buy", shape.triangleup, location.belowbar, color.green)
plotshape(sellSignal, "Sell", shape.triangledown, location.abovebar, color.red)//@version=5ta. prefix for technical analysis functionsinput() for customizable parametersstrategy() for backtestable strategies, indicator() for studies