Market Gate GO/NO-GO (Long Only)
This indicator is for traders who want a quick, objective answer to one question before they take any long: “Is the overall market environment supportive right now, or am I fighting the tape?” Most losses in long-only swing trading don’t come from picking the wrong stock — they come from buying good setups while the broader market is risk-off. This script is meant to solve that by acting as a top-level market regime gate you keep on your chart (or in a separate window) and check first. It does not place trades, does not connect to any broker, and it does not predict. It simply prints a daily GO / NO-GO state based on market conditions, and you use it as a permission layer before taking any long setups on individual tickers (breakouts, pullbacks, SMA crosses, reclaim/hold, etc.).
A simple indicator , mechanical risk filter designed to keep long entries aligned with broader market conditions. It does not place trades and does not connect to any broker. It prints a daily GO/NO-GO state and is meant to be used as a “permission layer” before taking any long setups on individual tickers.
Logic (Strict Market Gate)
Market Gate is GO only when all three conditions are true (daily data):
- SPY is above its SMA(20)
- QQQ is above its SMA(20)
- VIX is below its SMA(10)
If any condition fails, Market Gate is NO-GO.
How to use
- GO = you’re allowed to take long setups on your chart.
- NO-GO = stand down (avoid new longs, avoid “catching falling knives”).
- Combine with your own entry trigger (e.g., SMA10 crossing above SMA20, reclaim/hold, breakouts).
- Works on any chart timeframe, but the gate itself always uses daily SPY/QQQ/VIX.
Signals / Visuals
- GO/NO markers are printed once per day (first bar of the day on intraday charts) to avoid label spam.
- Optional SMA10/20 plots can be used for your local entry timing.
Inputs
- Symbols: SPY, QQQ, CBOE:VIX (editable)
- Lengths: SPY/QQQ SMA length (default 20), VIX SMA length (default 10)
- Optional: require both SPY & QQQ above SMA (strict) vs either (looser)
Notes
This is a market-regime filter, not a full strategy. It will intentionally stay NO-GO during downtrends and volatility expansions. Always test and adjust to your own risk tolerance and instruments.
Made by: Gus Kazem • Find on TradingView
Source Code:
//@version=6
indicator("SMA10/20 Cross GO (Strict Market Gate) + Death Zone", overlay=true, max_labels_count=500)
// ─────────────────────────────────────────────────────────────────────────────
// Inputs
// ─────────────────────────────────────────────────────────────────────────────
src0 = input.source(close, "Source")
len10 = input.int(10, "SMA 10", minval=1)
len20 = input.int(20, "SMA 20", minval=1)
// Strict Market Gate (daily)
spySym0 = input.string("SPY", "SPY symbol")
qqqSym0 = input.string("QQQ", "QQQ symbol")
vixSym0 = input.string("CBOE:VIX", "VIX symbol")
spyLen0 = input.int(20, "SPY SMA length", minval=1)
qqqLen0 = input.int(20, "QQQ SMA length", minval=1)
vixLen0 = input.int(10, "VIX SMA length", minval=1)
// Death Cross settings (computed, not plotted)
dcFastLen0 = input.int(50, "Death Cross fast SMA (50)", minval=1)
dcSlowLen0 = input.int(200, "Death Cross slow SMA (200)", minval=1)
// ─────────────────────────────────────────────────────────────────────────────
// Plot SMA10 / SMA20 (current chart)
// ─────────────────────────────────────────────────────────────────────────────
s10_0 = ta.sma(src0, len10)
s20_0 = ta.sma(src0, len20)
plot(s10_0, linewidth=3, title="SMA 10")
plot(s20_0, linewidth=3, title="SMA 20")
// ─────────────────────────────────────────────────────────────────────────────
// Market Gate (STRICT): SPY > SMA20 AND QQQ > SMA20 AND VIX < SMA10
// Uses DAILY data regardless of chart timeframe.
// ─────────────────────────────────────────────────────────────────────────────
fD0(string sym, float expr) =>
request.security(sym, "D", expr, barmerge.gaps_off, barmerge.lookahead_off)
spyC0 = fD0(spySym0, close)
qqqC0 = fD0(qqqSym0, close)
vixC0 = fD0(vixSym0, close)
spySMA0 = ta.sma(spyC0, spyLen0)
qqqSMA0 = ta.sma(qqqC0, qqqLen0)
vixSMA0 = ta.sma(vixC0, vixLen0)
marketGO0 = (spyC0 > spySMA0) and (qqqC0 > qqqSMA0) and (vixC0 < vixSMA0)
// ─────────────────────────────────────────────────────────────────────────────
// GO / NO signals
// GO fires ONLY when SMA10 crosses ABOVE SMA20 AND Market Gate is GO (strict).
// NO fires when SMA10 crosses BELOW SMA20 (regardless of gate).
// ─────────────────────────────────────────────────────────────────────────────
goSignal0 = ta.crossover(s10_0, s20_0) and marketGO0
noSignal0 = ta.crossunder(s10_0, s20_0)
fStickyLabel(bool condition, float y, string labelText, color bgColor, color txtColor, style) =>
if condition
label.new(bar_index, y, labelText, xloc=xloc.bar_index, yloc=yloc.price, style=style, color=bgColor, textcolor=txtColor, size=size.tiny)
fStickyLabel(goSignal0, low, "GO", color.lime, color.black, label.style_label_up)
fStickyLabel(noSignal0, high, "NO", color.red, color.rgb(31, 13, 24), label.style_label_down)
// ─────────────────────────────────────────────────────────────────────────────
// Death Cross mark (orange): SMA50 crosses BELOW SMA200 (on chart symbol)
// ─────────────────────────────────────────────────────────────────────────────
dcFast0 = ta.sma(src0, dcFastLen0)
dcSlow0 = ta.sma(src0, dcSlowLen0)
deathCross0 = ta.crossunder(dcFast0, dcSlow0)
fStickyLabel(deathCross0, high, "Death Zone", color.orange, color.black, label.style_label_down)