OPEN-SOURCE SCRIPT
MNQ Pro Scalping | SMA20 + VWAP Color

//version=5
TIFFANY//version=5
indicator("MNQ Pro Scalping | SMA20 + VWAP Color + ATR SLTP + Fake Breakout", overlay=true)
// ===== INPUTS =====
smaLen = input.int(20, "SMA Length")
atrLen = input.int(14, "ATR Length")
slMult = input.float(1.0, "SL = ATR x", step=0.1)
tpMult = input.float(1.5, "TP = ATR x", step=0.1)
showNY = input.bool(true, "Only New York Session (09:30–16:00 ET)")
// ===== NY SESSION FILTER =====
inNY = not showNY or time(timeframe.period, "0930-1600")
// ===== SMA 20 =====
sma20 = ta.sma(close, smaLen)
smaColor = close > sma20 ? color.green : color.red
plot(sma20, "SMA 20", color=smaColor, linewidth=2)
// ===== VWAP (COLOR CHANGE) =====
vwapVal = ta.vwap(hlc3)
vwapColor = close > vwapVal ? color.green : color.red
plot(vwapVal, "VWAP", color=vwapColor, linewidth=2)
// ===== ATR =====
atr = ta.atr(atrLen)
// ===== CROSS CONDITIONS =====
crossUp = ta.crossover(close, sma20)
crossDown = ta.crossunder(close, sma20)
// ===== VALID TRADE CONDITIONS =====
longCond = crossUp and close > vwapVal and inNY
shortCond = crossDown and close < vwapVal and inNY
// ===== ATR SL / TP LEVELS =====
longSL = close - atr * slMult
longTP = close + atr * tpMult
shortSL = close + atr * slMult
shortTP = close - atr * tpMult
// ===== PLOT SL / TP WHEN SIGNAL =====
plot(longCond ? longSL : na, "Long SL", color=color.red, style=plot.style_linebr)
plot(longCond ? longTP : na, "Long TP", color=color.green, style=plot.style_linebr)
plot(shortCond ? shortSL : na, "Short SL", color=color.red, style=plot.style_linebr)
plot(shortCond ? shortTP : na, "Short TP", color=color.green, style=plot.style_linebr)
// ===== FAKE BREAKOUT DETECTION =====
// Giá cắt SMA nhưng đóng nến quay ngược lại
fakeUp = ta.crossover(high, sma20) and close < sma20
fakeDown = ta.crossunder(low, sma20) and close > sma20
plotshape(fakeUp and inNY, title="Fake Up", style=shape.xcross, location=location.abovebar, color=color.red, size=size.small)
plotshape(fakeDown and inNY, title="Fake Down", style=shape.xcross, location=location.belowbar, color=color.green, size=size.small)
// ===== SIGNAL SHAPES =====
plotshape(longCond, title="LONG", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortCond, title="SHORT", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// ===== ALERTS =====
alertcondition(longCond,
title="MNQ LONG – ATR Setup",
message="MNQ LONG: Cross ABOVE SMA20 | Above VWAP | ATR SL/TP valid")
alertcondition(shortCond,
title="MNQ SHORT – ATR Setup",
message="MNQ SHORT: Cross BELOW SMA20 | Below VWAP | ATR SL/TP valid")
alertcondition(fakeUp,
title="Fake Breakout UP",
message="WARNING: Fake breakout ABOVE SMA20")
alertcondition(fakeDown,
title="Fake Breakout DOWN",
message="WARNING: Fake breakout BELOW SMA20")
TIFFANY//version=5
indicator("MNQ Pro Scalping | SMA20 + VWAP Color + ATR SLTP + Fake Breakout", overlay=true)
// ===== INPUTS =====
smaLen = input.int(20, "SMA Length")
atrLen = input.int(14, "ATR Length")
slMult = input.float(1.0, "SL = ATR x", step=0.1)
tpMult = input.float(1.5, "TP = ATR x", step=0.1)
showNY = input.bool(true, "Only New York Session (09:30–16:00 ET)")
// ===== NY SESSION FILTER =====
inNY = not showNY or time(timeframe.period, "0930-1600")
// ===== SMA 20 =====
sma20 = ta.sma(close, smaLen)
smaColor = close > sma20 ? color.green : color.red
plot(sma20, "SMA 20", color=smaColor, linewidth=2)
// ===== VWAP (COLOR CHANGE) =====
vwapVal = ta.vwap(hlc3)
vwapColor = close > vwapVal ? color.green : color.red
plot(vwapVal, "VWAP", color=vwapColor, linewidth=2)
// ===== ATR =====
atr = ta.atr(atrLen)
// ===== CROSS CONDITIONS =====
crossUp = ta.crossover(close, sma20)
crossDown = ta.crossunder(close, sma20)
// ===== VALID TRADE CONDITIONS =====
longCond = crossUp and close > vwapVal and inNY
shortCond = crossDown and close < vwapVal and inNY
// ===== ATR SL / TP LEVELS =====
longSL = close - atr * slMult
longTP = close + atr * tpMult
shortSL = close + atr * slMult
shortTP = close - atr * tpMult
// ===== PLOT SL / TP WHEN SIGNAL =====
plot(longCond ? longSL : na, "Long SL", color=color.red, style=plot.style_linebr)
plot(longCond ? longTP : na, "Long TP", color=color.green, style=plot.style_linebr)
plot(shortCond ? shortSL : na, "Short SL", color=color.red, style=plot.style_linebr)
plot(shortCond ? shortTP : na, "Short TP", color=color.green, style=plot.style_linebr)
// ===== FAKE BREAKOUT DETECTION =====
// Giá cắt SMA nhưng đóng nến quay ngược lại
fakeUp = ta.crossover(high, sma20) and close < sma20
fakeDown = ta.crossunder(low, sma20) and close > sma20
plotshape(fakeUp and inNY, title="Fake Up", style=shape.xcross, location=location.abovebar, color=color.red, size=size.small)
plotshape(fakeDown and inNY, title="Fake Down", style=shape.xcross, location=location.belowbar, color=color.green, size=size.small)
// ===== SIGNAL SHAPES =====
plotshape(longCond, title="LONG", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortCond, title="SHORT", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// ===== ALERTS =====
alertcondition(longCond,
title="MNQ LONG – ATR Setup",
message="MNQ LONG: Cross ABOVE SMA20 | Above VWAP | ATR SL/TP valid")
alertcondition(shortCond,
title="MNQ SHORT – ATR Setup",
message="MNQ SHORT: Cross BELOW SMA20 | Below VWAP | ATR SL/TP valid")
alertcondition(fakeUp,
title="Fake Breakout UP",
message="WARNING: Fake breakout ABOVE SMA20")
alertcondition(fakeDown,
title="Fake Breakout DOWN",
message="WARNING: Fake breakout BELOW SMA20")
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.