10 Pine Script Indicators Ready to Copy on TradingView
All indicators below are Pine Script v5, AI-generated and tested on TradingView. Just copy the code, paste into the Pine Editor, and add to chart.
π How to use each indicator
TradingView β Pine Editor (bottom panel) β delete the default code β paste the indicator β “Add to chart”. For a detailed tutorial, see How to Use AI to Build Indicators.
RSI with Buy/Sell Arrows
Green buy arrows when RSI crosses below 30, red sell arrows when it crosses above 70. Colored background + alerts.
//@version=5
indicator("RSI Arrows β IA Trader Pro", overlay=true)
rsiP = input.int(14, "RSI Period")
ob = input.int(70, "Overbought")
os = input.int(30, "Oversold")
r = ta.rsi(close, rsiP)
buy = ta.crossunder(r, os)
sell = ta.crossover(r, ob)
plotshape(buy, "Buy", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(sell, "Sell", shape.triangledown, location.abovebar, color.red, size=size.normal)
bgcolor(r < os ? color.new(color.green, 90) : r > ob ? color.new(color.red, 90) : na)
alertcondition(buy, "RSI Buy", "RSI oversold")
alertcondition(sell, "RSI Sell", "RSI overbought")EMA 9/21 Crossover with Volume
Arrows when fast EMA crosses slow EMA WITH volume above average. Bars colored by trend.
//@version=5
indicator("EMA Cross + Vol β IA Trader Pro", overlay=true)
f = input.int(9, "Fast EMA")
s = input.int(21, "Slow EMA")
vl = input.int(20, "Volume Average")
ef = ta.ema(close, f)
es = ta.ema(close, s)
hv = volume > ta.sma(volume, vl)
bc = ta.crossover(ef, es) and hv
sc = ta.crossunder(ef, es) and hv
plot(ef, "Fast EMA", color.green, 2)
plot(es, "Slow EMA", color.red, 2)
plotshape(bc, "Buy", shape.triangleup, location.belowbar, color.green, size=size.large)
plotshape(sc, "Sell", shape.triangledown, location.abovebar, color.red, size=size.large)
barcolor(ef > es ? color.green : color.red)
alertcondition(bc, "Bull Cross", "EMA crossed up + volume")
alertcondition(sc, "Bear Cross", "EMA crossed down + volume")Bollinger Bands + RSI Combo
Buy signal when price touches lower band AND RSI is oversold. BUY/SELL labels on the chart.
//@version=5
indicator("BB + RSI β IA Trader Pro", overlay=true)
[m, u, l] = ta.bb(close, 20, 2.0)
r = ta.rsi(close, 14)
buy = close <= l and r < 35
sell = close >= u and r > 65
p1 = plot(u, "BB Upper", color.red, 1)
p2 = plot(l, "BB Lower", color.green, 1)
plot(m, "BB Middle", color.gray, 1)
fill(p1, p2, color.new(color.blue, 92))
plotshape(buy, "BUY", shape.labelup, location.belowbar, color.green, text="BUY", textcolor=color.white, size=size.large)
plotshape(sell, "SELL", shape.labeldown, location.abovebar, color.red, text="SELL", textcolor=color.white, size=size.large)
alertcondition(buy, "BB+RSI Buy", "Price at lower band + low RSI")
alertcondition(sell, "BB+RSI Sell", "Price at upper band + high RSI")Colored MACD Histogram
MACD with histogram that changes color based on rising/falling momentum. Arrows on crossover.
//@version=5
indicator("MACD Color β IA Trader Pro")
[macdLine, signalLine, hist] = ta.macd(close, 12, 26, 9)
histColor = hist >= 0 ? (hist > hist[1] ? #b8893d : #80E0A0) : (hist < hist[1] ? #dc2626 : #FF9090)
plot(macdLine, "MACD", color.blue, 2)
plot(signalLine, "Signal", color.orange, 2)
plot(hist, "Histogram", histColor, 1, plot.style_columns)
cross_up = ta.crossover(macdLine, signalLine)
cross_dn = ta.crossunder(macdLine, signalLine)
plotshape(cross_up, "Up", shape.triangleup, location.bottom, color.green, size=size.small)
plotshape(cross_dn, "Down", shape.triangledown, location.top, color.red, size=size.small)
alertcondition(cross_up, "MACD Up", "MACD crossed up")
alertcondition(cross_dn, "MACD Down", "MACD crossed down")Automatic Support and Resistance
Detects swing high/low pivots and draws horizontal lines at the most recent support and resistance levels.
//@version=5
indicator("Support/Resistance β IA Trader Pro", overlay=true, max_lines_count=10)
lb = input.int(20, "Lookback")
ph = ta.pivothigh(high, lb, lb)
pl = ta.pivotlow(low, lb, lb)
if not na(ph)
line.new(bar_index-lb, ph, bar_index, ph, color=color.red, width=2, extend=extend.right, style=line.style_dashed)
label.new(bar_index-lb, ph, "R " + str.tostring(ph, "#.##"), color=color.new(color.red, 80), textcolor=color.red, style=label.style_label_down, size=size.small)
if not na(pl)
line.new(bar_index-lb, pl, bar_index, pl, color=color.green, width=2, extend=extend.right, style=line.style_dashed)
label.new(bar_index-lb, pl, "S " + str.tostring(pl, "#.##"), color=color.new(color.green, 80), textcolor=color.green, style=label.style_label_up, size=size.small)Simplified Volume Profile
Colored volume bars: green when volume is above average (strength), red when below (weakness).
//@version=5
indicator("Volume Smart β IA Trader Pro")
vp = input.int(20, "Volume Average")
vm = ta.sma(volume, vp)
vr = volume / vm
vc = vr > 2.0 ? #b8893d : vr > 1.0 ? #4CAF50 : vr > 0.5 ? #ea580c : #dc2626
plot(volume, "Volume", vc, 2, plot.style_columns)
plot(vm, "Average", color.white, 1)
hline(0)
alertcondition(volume > vm * 2, "Volume Spike", "Volume 2x above average")EMA Rainbow (5 averages)
5 EMAs (9, 21, 50, 100, 200) with rainbow colors. When all are aligned = strong trend.
//@version=5
indicator("EMA Rainbow β IA Trader Pro", overlay=true)
plot(ta.ema(close, 9), "EMA 9", #b8893d, 2)
plot(ta.ema(close, 21), "EMA 21", #448AFF, 2)
plot(ta.ema(close, 50), "EMA 50", #ea580c, 2)
plot(ta.ema(close, 100), "EMA 100", #FF9800, 2)
plot(ta.ema(close, 200), "EMA 200", #dc2626, 3)RSI Divergence Detector
Detects divergences between price and RSI. Bullish (buy) and bearish (sell) divergences with labels.
//@version=5
indicator("RSI Divergence β IA Trader Pro", overlay=true)
rsiLen = input.int(14, "RSI Period")
lb = input.int(5, "Pivot Lookback")
r = ta.rsi(close, rsiLen)
pl = ta.pivotlow(low, lb, lb)
ph = ta.pivothigh(high, lb, lb)
// Bullish Divergence: price makes a lower low, RSI makes a higher low
bullDiv = not na(pl) and low[lb] < ta.valuewhen(not na(pl), low[lb], 1) and r[lb] > ta.valuewhen(not na(pl), r[lb], 1)
// Bearish Divergence: price makes a higher high, RSI makes a lower high
bearDiv = not na(ph) and high[lb] > ta.valuewhen(not na(ph), high[lb], 1) and r[lb] < ta.valuewhen(not na(ph), r[lb], 1)
plotshape(bullDiv, "Bull Div", shape.labelup, location.belowbar, color.green, text="DIV+", textcolor=color.white, size=size.small, offset=-lb)
plotshape(bearDiv, "Bear Div", shape.labeldown, location.abovebar, color.red, text="DIV-", textcolor=color.white, size=size.small, offset=-lb)
alertcondition(bullDiv, "Bullish Divergence", "RSI bullish divergence")
alertcondition(bearDiv, "Bearish Divergence", "RSI bearish divergence")Candle Pattern Detector
Detects candlestick patterns: Doji, Hammer, Engulfing (bullish and bearish). Labels on the chart.
//@version=5
indicator("Candle Patterns β IA Trader Pro", overlay=true)
body = math.abs(close - open)
wick = high - low
// Doji: very small body
doji = body < wick * 0.1
// Hammer: long lower shadow, small body at top
hammer = (low == math.min(open, close) - (wick * 0.6)) == false and (math.min(open, close) - low) > body * 2 and (high - math.max(open, close)) < body * 0.5 and close > open
// Bullish Engulfing
bullEngulf = close[1] < open[1] and close > open and close > open[1] and open < close[1]
// Bearish Engulfing
bearEngulf = close[1] > open[1] and close < open and close < open[1] and open > close[1]
plotshape(doji, "Doji", shape.diamond, location.abovebar, color.yellow, size=size.tiny)
plotshape(hammer, "Hammer", shape.triangleup, location.belowbar, #b8893d, size=size.small)
plotshape(bullEngulf, "Bull Engulf", shape.labelup, location.belowbar, color.green, text="BE", textcolor=color.white, size=size.small)
plotshape(bearEngulf, "Bear Engulf", shape.labeldown, location.abovebar, color.red, text="BE", textcolor=color.white, size=size.small)Super Trend Indicator
Line that follows the trend and changes color (green=up, red=down). Arrows on direction change.
//@version=5
indicator("SuperTrend β IA Trader Pro", overlay=true)
atrP = input.int(10, "ATR Period")
mult = input.float(3.0, "Multiplier")
atr = ta.atr(atrP)
up = hl2 - mult * atr
dn = hl2 + mult * atr
var float trendUp = na
var float trendDn = na
var int trend = 1
trendUp := close[1] > nz(trendUp[1]) ? math.max(up, nz(trendUp[1])) : up
trendDn := close[1] < nz(trendDn[1]) ? math.min(dn, nz(trendDn[1])) : dn
trend := close > nz(trendDn[1]) ? 1 : close < nz(trendUp[1]) ? -1 : nz(trend[1])
st = trend == 1 ? trendUp : trendDn
stColor = trend == 1 ? #b8893d : #dc2626
plot(st, "SuperTrend", stColor, 3)
buySignal = trend == 1 and trend[1] == -1
sellSignal = trend == -1 and trend[1] == 1
plotshape(buySignal, "Buy", shape.triangleup, location.belowbar, #b8893d, size=size.normal)
plotshape(sellSignal, "Sell", shape.triangledown, location.abovebar, #dc2626, size=size.normal)
alertcondition(buySignal, "ST Buy", "SuperTrend turned up")
alertcondition(sellSignal, "ST Sell", "SuperTrend turned down")π Test these indicators with a free demo account β analyze on TradingView and trade on Deriv:
Open Deriv Demo Account βAlternative: IQ Option Demo β
π Want to build your own indicators?
β How to Use AI to Build Indicators (5 Ready Prompts)
β TradingView Free: Complete Guide
β Deriv Bot: No-Code Bots
β Start Here
