OPEN-SOURCE SCRIPT

Alertes Trading Manuel

38
//version=6
indicator("Signal simple +0.5% LONG", overlay = true)

// --- Paramètres ---
tpPctInput = input.float(0.5, "TP (%)", step = 0.1) // objectif pour toi : 0.5%
slPctInput = input.float(0.3, "SL (%)", step = 0.1) // SL indicatif : 0.3%

tpPct = tpPctInput / 100.0
slPct = slPctInput / 100.0

emaLenFast = input.int(50, "EMA rapide (intraday)", minval = 1)
emaLenSlow = input.int(200, "EMA lente (intraday)", minval = 1)
volLen = input.int(20, "Période moyenne Volume", minval = 1)

// --- Tendance daily : MA200 jours ---
ma200D = request.security(syminfo.tickerid, "D", ta.sma(close, 200))
above200D = close > ma200D

// --- Tendance intraday ---
emaFast = ta.ema(close, emaLenFast)
emaSlow = ta.ema(close, emaLenSlow)

upTrendIntraday = close > emaFast and emaFast > emaSlow

// --- MACD & RSI ---
[macdLine, macdSignal, _] = ta.macd(close, 12, 26, 9)
rsi = ta.rsi(close, 14)

macdOK = macdLine > macdSignal
rsiOK = rsi > 49 and rsi < 75

// --- Volume ---
volMa = ta.sma(volume, volLen)
volOK = volume > volume[1] and volume > volMa

// --- Signal LONG simple ---
longSignal = above200D and upTrendIntraday and macdOK and rsiOK and volOK

// --- Affichage du signal ---
plotshape(
longSignal,
title = "Signal LONG",
location = location.belowbar,
style = shape.triangleup,
color = color.lime,
size = size.small,
text = "LONG"
)

// --- Lignes TP / SL indicatives basées sur le dernier signal ---
var float tpLine = na
var float slLine = na

if longSignal
tpLine := close * (1 + tpPct)
slLine := close * (1 - slPct)

// Les lignes restent jusqu'au prochain signal
plot(tpLine, "TP indicatif", color = color.new(color.green, 50), style = plot.style_linebr)
plot(slLine, "SL indicatif", color = color.new(color.red, 50), style = plot.style_linebr)

// --- Affichage des moyennes ---
plot(emaFast, "EMA rapide", color = color.new(color.blue, 40))
plot(emaSlow, "EMA lente", color = color.new(color.orange, 40))
plot(ma200D, "MA200 jours (daily)", color = color.new(color.fuchsia, 0), linewidth = 2)

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.