OPEN-SOURCE SCRIPT

Scalping Strategy

65
//version=5
strategy("Scalping Strategy", overlay=true)

// Indicators
ma50 = ta.sma(close, 50)
ema20 = ta.ema(close, 20)
ema200 = ta.ema(close, 200)
rsi = ta.rsi(close, 14)
osc = ta.stoch(close, high, low, 14)
vol = volume

// Trend Confirmation
bullishTrend = ema20 > ema200 and close > ma50
bearishTrend = ema20 < ema200 and close < ma50

// RSI Divergence Detection
rsiOverbought = rsi > 70
rsiOversold = rsi < 30

// Oscillator Confirmation
oscBull = osc < 20
oscBear = osc > 80

// Volume Confirmation
highVolume = vol > ta.sma(vol, 20)

// Entry Conditions
buySignal = bullishTrend and rsiOversold and oscBull and highVolume
sellSignal = bearishTrend and rsiOverbought and oscBear and highVolume

// Execute Trades
if buySignal
strategy.entry("Buy", strategy.long)
if sellSignal
strategy.entry("Sell", strategy.short)

// Plot indicators
plot(ma50, color=color.blue, title="MA 50")
plot(ema20, color=color.green, title="EMA 20")
plot(ema200, color=color.red, title="EMA 200")

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.