OPEN-SOURCE SCRIPT
Alertes Trading Manuel

//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)
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)
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.