OPEN-SOURCE SCRIPT
SPX AbuBasel Scalping PRO – Stable

//version=5
indicator("SPX AbuBasel Scalping PRO – Stable", overlay=true, precision=2)
// ==== Inputs ====
lenRSI = input.int(7, "RSI Length")
tp1ATR = input.float(0.35, "TP1 ATR Factor", step=0.05)
tp2ATR = input.float(0.70, "TP2 ATR Factor", step=0.05)
tp3ATR = input.float(1.00, "TP3 ATR Factor", step=0.05)
slATR = input.float(0.45, "SL ATR Factor", step=0.05)
useVol = input.bool(true, "Use Volume Filter")
// ==== Indicators ====
rsi = ta.rsi(close, lenRSI)
vwap = ta.vwap
atr = ta.atr(14)
// Bollinger Bands
basis = ta.sma(close, 20)
dev = 2.0 * ta.stdev(close, 20)
upper = basis + dev
lower = basis - dev
// Volume filter
volOK = volume > ta.sma(volume, 20)
// Divergence
bullDiv = low < low[1] and rsi > rsi[1]
bearDiv = high > high[1] and rsi < rsi[1]
// Reversal candles
bullCandle = close > open and close > high[1]
bearCandle = close < open and close < low[1]
// VWAP slope
trendUp = vwap > vwap[2]
trendDown = vwap < vwap[2]
// ==== Entry Conditions ====
buySig = bullDiv and bullCandle and close > vwap and trendUp and (not useVol or volOK) and close < lower
sellSig = bearDiv and bearCandle and close < vwap and trendDown and (not useVol or volOK) and close > upper
// ==== Targets ====
tp1 = buySig ? close + atr * tp1ATR : sellSig ? close - atr * tp1ATR : na
tp2 = buySig ? close + atr * tp2ATR : sellSig ? close - atr * tp2ATR : na
tp3 = buySig ? close + atr * tp3ATR : sellSig ? close - atr * tp3ATR : na
sl = buySig ? close - atr * slATR : sellSig ? close + atr * slATR : na
// ==== Plot Signals ====
plotshape(buySig, title="BUY", style=shape.labelup, color=color.green, text="BUY", size=size.small)
plotshape(sellSig, title="SELL", style=shape.labeldown, color=color.red, text="SELL", size=size.small)
// ==== Draw Levels ====
if buySig or sellSig
line.new(bar_index, tp1, bar_index + 1, tp1, extend=extend.right, color=color.new(color.green, 0))
line.new(bar_index, tp2, bar_index + 1, tp2, extend=extend.right, color=color.new(color.lime, 0))
line.new(bar_index, tp3, bar_index + 1, tp3, extend=extend.right, color=color.new(color.green, 40))
line.new(bar_index, sl, bar_index + 1, sl, extend=extend.right, color=color.new(color.red, 0))
// ==== Alerts ====
alertcondition(buySig, "SPX BUY", "AbuBasel PRO: BUY Signal")
alertcondition(sellSig, "SPX SELL", "AbuBasel PRO: SELL Signal")
indicator("SPX AbuBasel Scalping PRO – Stable", overlay=true, precision=2)
// ==== Inputs ====
lenRSI = input.int(7, "RSI Length")
tp1ATR = input.float(0.35, "TP1 ATR Factor", step=0.05)
tp2ATR = input.float(0.70, "TP2 ATR Factor", step=0.05)
tp3ATR = input.float(1.00, "TP3 ATR Factor", step=0.05)
slATR = input.float(0.45, "SL ATR Factor", step=0.05)
useVol = input.bool(true, "Use Volume Filter")
// ==== Indicators ====
rsi = ta.rsi(close, lenRSI)
vwap = ta.vwap
atr = ta.atr(14)
// Bollinger Bands
basis = ta.sma(close, 20)
dev = 2.0 * ta.stdev(close, 20)
upper = basis + dev
lower = basis - dev
// Volume filter
volOK = volume > ta.sma(volume, 20)
// Divergence
bullDiv = low < low[1] and rsi > rsi[1]
bearDiv = high > high[1] and rsi < rsi[1]
// Reversal candles
bullCandle = close > open and close > high[1]
bearCandle = close < open and close < low[1]
// VWAP slope
trendUp = vwap > vwap[2]
trendDown = vwap < vwap[2]
// ==== Entry Conditions ====
buySig = bullDiv and bullCandle and close > vwap and trendUp and (not useVol or volOK) and close < lower
sellSig = bearDiv and bearCandle and close < vwap and trendDown and (not useVol or volOK) and close > upper
// ==== Targets ====
tp1 = buySig ? close + atr * tp1ATR : sellSig ? close - atr * tp1ATR : na
tp2 = buySig ? close + atr * tp2ATR : sellSig ? close - atr * tp2ATR : na
tp3 = buySig ? close + atr * tp3ATR : sellSig ? close - atr * tp3ATR : na
sl = buySig ? close - atr * slATR : sellSig ? close + atr * slATR : na
// ==== Plot Signals ====
plotshape(buySig, title="BUY", style=shape.labelup, color=color.green, text="BUY", size=size.small)
plotshape(sellSig, title="SELL", style=shape.labeldown, color=color.red, text="SELL", size=size.small)
// ==== Draw Levels ====
if buySig or sellSig
line.new(bar_index, tp1, bar_index + 1, tp1, extend=extend.right, color=color.new(color.green, 0))
line.new(bar_index, tp2, bar_index + 1, tp2, extend=extend.right, color=color.new(color.lime, 0))
line.new(bar_index, tp3, bar_index + 1, tp3, extend=extend.right, color=color.new(color.green, 40))
line.new(bar_index, sl, bar_index + 1, sl, extend=extend.right, color=color.new(color.red, 0))
// ==== Alerts ====
alertcondition(buySig, "SPX BUY", "AbuBasel PRO: BUY Signal")
alertcondition(sellSig, "SPX SELL", "AbuBasel PRO: SELL Signal")
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.