OPEN-SOURCE SCRIPT
SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)

//version=5
indicator("SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)", overlay=true, max_labels_count=500)
// ---------------- INPUTS ----------------
emaFastLen = input.int(9, "EMA Fast")
emaSlowLen = input.int(21, "EMA Slow")
atrLen = input.int(14, "ATR Length")
atrMultSL = input.float(1.2, "SL = ATR *")
tp1mult = input.float(1.0, "TP1 = ATR *")
tp2mult = input.float(1.5, "TP2 = ATR *")
tp3mult = input.float(2.0, "TP3 = ATR *")
minBars = input.int(3, "Min bars between signals")
showDashboard = input.bool(true, "Show Dashboard")
// ---------------- INDICATORS ----------------
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
atr = ta.atr(atrLen)
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow
crossUp = ta.crossover(emaFast, emaSlow) and bullTrend
crossDown = ta.crossunder(emaFast, emaSlow) and bearTrend
var int lastSignal = na
okSignal = na(lastSignal) or (bar_index - lastSignal > minBars)
buySignal = crossUp and okSignal
sellSignal = crossDown and okSignal
if buySignal or sellSignal
lastSignal := bar_index
// ---------------- TP & SL ----------------
var float sl = na
var float tp1 = na
var float tp2 = na
var float tp3 = na
if buySignal
sl := close - atr * atrMultSL
tp1 := close + atr * tp1mult
tp2 := close + atr * tp2mult
tp3 := close + atr * tp3mult
if sellSignal
sl := close + atr * atrMultSL
tp1 := close - atr * tp1mult
tp2 := close - atr * tp2mult
tp3 := close - atr * tp3mult
// ---------------- ALERTS ----------------
alertcondition(buySignal, title="BUY", message="BUY Signal")
alertcondition(sellSignal, title="SELL", message="SELL Signal")
alertcondition(ta.cross(close, tp1), title="TP1", message="TP1 Hit")
alertcondition(ta.cross(close, tp2), title="TP2", message="TP2 Hit")
alertcondition(ta.cross(close, tp3), title="TP3", message="TP3 Hit")
alertcondition(ta.cross(close, sl), title="SL", message="Stop Loss Hit")
// ---------------- DASHBOARD ----------------
if showDashboard
var table dash = table.new(position.top_right, 1, 5)
if barstate.islast
table.cell(dash, 0, 0, "SCALPING PRO V2", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 0, 1, "Trend: " + (bullTrend ? "Bull" : bearTrend ? "Bear" : "Neutral"))
table.cell(dash, 0, 2, "ATR: " + str.tostring(atr, format.mintick))
table.cell(dash, 0, 3, "Last Signal: " + (buySignal ? "BUY" : sellSignal ? "SELL" : "NONE"))
table.cell(dash, 0, 4, "EMA Fast/Slow OK")
indicator("SCALPING PRO V2 - INTERMÉDIANT (Dashboard + TP/SL + Alerts)", overlay=true, max_labels_count=500)
// ---------------- INPUTS ----------------
emaFastLen = input.int(9, "EMA Fast")
emaSlowLen = input.int(21, "EMA Slow")
atrLen = input.int(14, "ATR Length")
atrMultSL = input.float(1.2, "SL = ATR *")
tp1mult = input.float(1.0, "TP1 = ATR *")
tp2mult = input.float(1.5, "TP2 = ATR *")
tp3mult = input.float(2.0, "TP3 = ATR *")
minBars = input.int(3, "Min bars between signals")
showDashboard = input.bool(true, "Show Dashboard")
// ---------------- INDICATORS ----------------
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
atr = ta.atr(atrLen)
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow
crossUp = ta.crossover(emaFast, emaSlow) and bullTrend
crossDown = ta.crossunder(emaFast, emaSlow) and bearTrend
var int lastSignal = na
okSignal = na(lastSignal) or (bar_index - lastSignal > minBars)
buySignal = crossUp and okSignal
sellSignal = crossDown and okSignal
if buySignal or sellSignal
lastSignal := bar_index
// ---------------- TP & SL ----------------
var float sl = na
var float tp1 = na
var float tp2 = na
var float tp3 = na
if buySignal
sl := close - atr * atrMultSL
tp1 := close + atr * tp1mult
tp2 := close + atr * tp2mult
tp3 := close + atr * tp3mult
if sellSignal
sl := close + atr * atrMultSL
tp1 := close - atr * tp1mult
tp2 := close - atr * tp2mult
tp3 := close - atr * tp3mult
// ---------------- ALERTS ----------------
alertcondition(buySignal, title="BUY", message="BUY Signal")
alertcondition(sellSignal, title="SELL", message="SELL Signal")
alertcondition(ta.cross(close, tp1), title="TP1", message="TP1 Hit")
alertcondition(ta.cross(close, tp2), title="TP2", message="TP2 Hit")
alertcondition(ta.cross(close, tp3), title="TP3", message="TP3 Hit")
alertcondition(ta.cross(close, sl), title="SL", message="Stop Loss Hit")
// ---------------- DASHBOARD ----------------
if showDashboard
var table dash = table.new(position.top_right, 1, 5)
if barstate.islast
table.cell(dash, 0, 0, "SCALPING PRO V2", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 0, 1, "Trend: " + (bullTrend ? "Bull" : bearTrend ? "Bear" : "Neutral"))
table.cell(dash, 0, 2, "ATR: " + str.tostring(atr, format.mintick))
table.cell(dash, 0, 3, "Last Signal: " + (buySignal ? "BUY" : sellSignal ? "SELL" : "NONE"))
table.cell(dash, 0, 4, "EMA Fast/Slow OK")
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no pretenden ser, ni constituyen, asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no pretenden ser, ni constituyen, asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.