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")
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。