OPEN-SOURCE SCRIPT

ULTRA PRO SCALPING V6

49
//version=6
indicator("ULTRA PRO SCALPING V6", overlay=true, max_lines_count=500, max_labels_count=500)

// SETTINGS
lengthEMA = input.int(21, "EMA Trend")
riskRR = input.float(1.5, "Ratio TP/SL", step=0.1)
sl_pips = input.float(0.15, "Stop Loss (%)", step=0.01)
showTP_SL = input.bool(true, "Afficher TP & SL")
showSignals = input.bool(true, "Afficher Signaux")

// TREND FILTER
ema = ta.ema(close, lengthEMA)
plot(ema, "EMA", color=color.new(color.yellow, 0), linewidth=2)

// ENTRY SIGNALS
longSignal = ta.crossover(close, ema)
shortSignal = ta.crossunder(close, ema)

// TP/SL SYSTEM
var float lastSL = na
var float lastTP = na

if longSignal
lastSL := close * (1 - sl_pips/100)
lastTP := close + (close - lastSL) * riskRR

if shortSignal
lastSL := close * (1 + sl_pips/100)
lastTP := close - (lastSL - close) * riskRR

// DISPLAY
if showTP_SL and not na(lastSL)
line.new(bar_index-1, lastSL, bar_index, lastSL, color=color.red)
label.new(bar_index, lastSL, "SL", color=color.red)

if showTP_SL and not na(lastTP)
line.new(bar_index-1, lastTP, bar_index, lastTP, color=color.green)
label.new(bar_index, lastTP, "TP", color=color.green)

if showSignals and longSignal
label.new(bar_index, low, "BUY", color=color.green, style=label.style_label_up)

if showSignals and shortSignal
label.new(bar_index, high, "SELL", color=color.red, style=label.style_label_down)

// ALERTS
alertcondition(longSignal, "BUY Signal", "Signal d’achat détecté")
alertcondition(shortSignal, "SELL Signal", "Signal de vente détecté")

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.