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")
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน