OPEN-SOURCE SCRIPT

Scalping Indicator

//version=5
indicator("Scalping Indicator", overlay=true)

// Input parameters
fastEMA = input(9, title="Fast EMA Length")
slowEMA = input(21, title="Slow EMA Length")
signalSMA = input(9, title="Signal SMA Length")
rsiLength = input(14, title="RSI Length")
rsiOverbought = input(70, title="RSI Overbought Level")
rsiOversold = input(30, title="RSI Oversold Level")

// EMA calculations
fastEma = ta.ema(close, fastEMA)
slowEma = ta.ema(close, slowEMA)

// MACD calculations
[macdLine, signalLine, _] = ta.macd(close, fastEMA, slowEMA, signalSMA)

// RSI calculation
rsi = ta.rsi(close, rsiLength)

// Entry and exit conditions
longCondition = ta.crossover(fastEma, slowEma) and macdLine > signalLine and rsi < rsiOverbought
shortCondition = ta.crossunder(fastEma, slowEma) and macdLine < signalLine and rsi > rsiOversold

// Plot buy/sell signals
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Plot EMA lines
plot(fastEma, title="Fast EMA", color=color.blue)
plot(slowEma, title="Slow EMA", color=color.orange)

// Background highlights
bgcolor(longCondition ? color.new(color.green, 90) : na, title="Long Background")
bgcolor(shortCondition ? color.new(color.red, 90) : na, title="Short Background")
Chart patternsTrend AnalysisVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer