OPEN-SOURCE SCRIPT
Patrice - GC M1 Bot (MACD EMA RSI)

//version=6
indicator("Patrice - GC M1 Bot (MACD EMA RSI)", overlay = true)
//----------------------
// Inputs (optimisés GC)
//----------------------
emaLenFast = input.int(9, "EMA rapide")
emaLenSlow = input.int(14, "EMA lente")
rsiLen = input.int(14, "RSI length")
atrLen = input.int(14, "ATR length")
volLen = input.int(20, "Volume moyenne")
slMult = input.float(0.4, "SL = ATR x", step = 0.1)
tpMult = input.float(0.7, "TP = ATR x", step = 0.1)
minAtr = input.float(0.7, "ATR minimum pour trader", step = 0.1)
maxDistEmaPct = input.float(0.3, "Distance max EMA9 (%)", step = 0.1)
//----------------------
// Indicateurs
//----------------------
ema9 = ta.ema(close, emaLenFast)
ema14 = ta.ema(close, emaLenSlow)
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
hist = macdLine - signalLine
rsi = ta.rsi(close, rsiLen)
atr = ta.atr(atrLen)
volMa = ta.sma(volume, volLen)
//----------------------
// Session 9:30 - 11:00 (NY)
//----------------------
hourSession = hour(time, "America/New_York")
minuteSession = minute(time, "America/New_York")
inSession = (hourSession == 9 and minuteSession >= 30) or
(hourSession > 9 and hourSession < 11) or
(hourSession == 11 and minuteSession == 0)
//----------------------
// Filtres vol / ATR / distance EMA
//----------------------
volFilter = volume > volMa
atrFilter = atr > minAtr
distEmaPct = math.abs(close - ema9) / close * 100.0
distFilter = distEmaPct < maxDistEmaPct
//----------------------
// Tendance
//----------------------
bullTrend = close > ema9 and close > ema14 and ema9 > ema14
bearTrend = close < ema9 and close < ema14 and ema9 < ema14
//----------------------
// MACD : 2e barre
//----------------------
bullSecondBar = hist > 0 and hist[1] > 0 and hist[2] <= 0
bearSecondBar = hist < 0 and hist[1] < 0 and hist[2] >= 0
//----------------------
// Filtres RSI
//----------------------
rsiLongOk = rsi < 70 and rsi >= 45 and rsi <= 65
rsiShortOk = rsi > 30 and rsi >= 35 and rsi <= 55
//----------------------
// Gestion du risque (simple pour l'instant)
//----------------------
canTradeRisk = true
//----------------------
// Conditions d'entrée
//----------------------
longCond = bullTrend and bullSecondBar and rsiLongOk and inSession and volFilter and atrFilter and distFilter and canTradeRisk
shortCond = bearTrend and bearSecondBar and rsiShortOk and inSession and volFilter and atrFilter and distFilter and canTradeRisk
//----------------------
// SL / TP (info seulement, pas d'ordres)
//----------------------
slPoints = atr * slMult
tpPoints = atr * tpMult
longSL = close - slPoints
longTP = close + tpPoints
shortSL = close + slPoints
shortTP = close - tpPoints
//----------------------
// Visuels
//----------------------
plot(ema9, title = "EMA 9")
plot(ema14, title = "EMA 14")
plotshape(longCond, title = "Signal Long", style = shape.triangleup, location = location.belowbar, size = size.tiny, text = "L")
plotshape(shortCond, title = "Signal Short", style = shape.triangledown, location = location.abovebar, size = size.tiny, text = "S")
//----------------------
// Conditions d'ALERTE
//----------------------
alertcondition(longCond, title = "ALERTE LONG", message = "Signal LONG Patrice GC bot")
alertcondition(shortCond, title = "ALERTE SHORT", message = "Signal SHORT Patrice GC bot")
indicator("Patrice - GC M1 Bot (MACD EMA RSI)", overlay = true)
//----------------------
// Inputs (optimisés GC)
//----------------------
emaLenFast = input.int(9, "EMA rapide")
emaLenSlow = input.int(14, "EMA lente")
rsiLen = input.int(14, "RSI length")
atrLen = input.int(14, "ATR length")
volLen = input.int(20, "Volume moyenne")
slMult = input.float(0.4, "SL = ATR x", step = 0.1)
tpMult = input.float(0.7, "TP = ATR x", step = 0.1)
minAtr = input.float(0.7, "ATR minimum pour trader", step = 0.1)
maxDistEmaPct = input.float(0.3, "Distance max EMA9 (%)", step = 0.1)
//----------------------
// Indicateurs
//----------------------
ema9 = ta.ema(close, emaLenFast)
ema14 = ta.ema(close, emaLenSlow)
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
hist = macdLine - signalLine
rsi = ta.rsi(close, rsiLen)
atr = ta.atr(atrLen)
volMa = ta.sma(volume, volLen)
//----------------------
// Session 9:30 - 11:00 (NY)
//----------------------
hourSession = hour(time, "America/New_York")
minuteSession = minute(time, "America/New_York")
inSession = (hourSession == 9 and minuteSession >= 30) or
(hourSession > 9 and hourSession < 11) or
(hourSession == 11 and minuteSession == 0)
//----------------------
// Filtres vol / ATR / distance EMA
//----------------------
volFilter = volume > volMa
atrFilter = atr > minAtr
distEmaPct = math.abs(close - ema9) / close * 100.0
distFilter = distEmaPct < maxDistEmaPct
//----------------------
// Tendance
//----------------------
bullTrend = close > ema9 and close > ema14 and ema9 > ema14
bearTrend = close < ema9 and close < ema14 and ema9 < ema14
//----------------------
// MACD : 2e barre
//----------------------
bullSecondBar = hist > 0 and hist[1] > 0 and hist[2] <= 0
bearSecondBar = hist < 0 and hist[1] < 0 and hist[2] >= 0
//----------------------
// Filtres RSI
//----------------------
rsiLongOk = rsi < 70 and rsi >= 45 and rsi <= 65
rsiShortOk = rsi > 30 and rsi >= 35 and rsi <= 55
//----------------------
// Gestion du risque (simple pour l'instant)
//----------------------
canTradeRisk = true
//----------------------
// Conditions d'entrée
//----------------------
longCond = bullTrend and bullSecondBar and rsiLongOk and inSession and volFilter and atrFilter and distFilter and canTradeRisk
shortCond = bearTrend and bearSecondBar and rsiShortOk and inSession and volFilter and atrFilter and distFilter and canTradeRisk
//----------------------
// SL / TP (info seulement, pas d'ordres)
//----------------------
slPoints = atr * slMult
tpPoints = atr * tpMult
longSL = close - slPoints
longTP = close + tpPoints
shortSL = close + slPoints
shortTP = close - tpPoints
//----------------------
// Visuels
//----------------------
plot(ema9, title = "EMA 9")
plot(ema14, title = "EMA 14")
plotshape(longCond, title = "Signal Long", style = shape.triangleup, location = location.belowbar, size = size.tiny, text = "L")
plotshape(shortCond, title = "Signal Short", style = shape.triangledown, location = location.abovebar, size = size.tiny, text = "S")
//----------------------
// Conditions d'ALERTE
//----------------------
alertcondition(longCond, title = "ALERTE LONG", message = "Signal LONG Patrice GC bot")
alertcondition(shortCond, title = "ALERTE SHORT", message = "Signal SHORT Patrice GC bot")
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.