OPEN-SOURCE SCRIPT

Improved Scalping Strategy with Alerts

//version=5
indicator("Improved Scalping Strategy with Alerts", overlay=true)

// EMA Settings for Scalping
emaLength = input.int(9, title="EMA Length")
emaValue = ta.ema(close, emaLength)
plot(emaValue, title="EMA", color=color.blue, linewidth=2)

// Volume Analysis for Scalping
volumeThreshold = input.float(2.0, title="Volume Threshold")
volumeSignal = volume > ta.sma(volume, 10) * volumeThreshold
bgcolor(volumeSignal ? color.new(color.blue, 90) : na, title="Volume Signal")

// RSI Settings for Scalping
rsiLength = input.int(9, title="RSI Length")
rsiValue = ta.rsi(close, rsiLength)
overbought = 70
oversold = 30
plot(rsiValue, title="RSI", color=color.purple, linewidth=2)
hline(overbought, "Overbought", color=color.red)
hline(oversold, "Oversold", color=color.green)

// MACD Settings for Scalping
fastLength = input.int(6, title="MACD Fast Length")
slowLength = input.int(13, title="MACD Slow Length")
signalSmoothing = input.int(5, title="MACD Signal Smoothing")
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
plot(macdLine, title="MACD Line", color=color.blue, linewidth=1)
plot(signalLine, title="Signal Line", color=color.red, linewidth=1)

// Strong Bullish and Bearish Conditions for Scalping
strongBullish = rsiValue > 70 and macdLine > signalLine and close > emaValue and volumeSignal
strongBearish = rsiValue < 30 and macdLine < signalLine and close < emaValue and volumeSignal

// Buy/Sell Signals for Scalping
buySignal = strongBullish
sellSignal = strongBearish

// Plot Buy/Sell Signals on Chart
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="LONG")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT")

// Alerts for Scalping
alertcondition(buySignal, title="Long Trade Alert", message="Strong Bullish Signal: Consider LONG Trade")
alertcondition(sellSignal, title="Short Trade Alert", message="Strong Bearish Signal: Consider SHORT Trade")

// Additional Alerts for Confirmation
confirmationBullish = ta.crossover(macdLine, signalLine) and rsiValue > 50 and close > emaValue and volumeSignal
confirmationBearish = ta.crossunder(macdLine, signalLine) and rsiValue < 50 and close < emaValue and volumeSignal

alertcondition(confirmationBullish, title="Confirmation Bullish Alert", message="Confirmation Bullish Signal: Consider LONG Trade")
alertcondition(confirmationBearish, title="Confirmation Bearish Alert", message="Confirmation Bearish Signal: Consider SHORT Trade")

Declinazione di responsabilità