PROTECTED SOURCE SCRIPT
Cập nhật MTF Traffic Lights (EMA 9 & 20 + MACD) — realtime

MTF Traffic Lights (4H / 1H / 15m / 5m / 3m / 1m)
What it does
This indicator paints a compact “traffic-light” panel in the top-right of your chart showing the trend state on six timeframes: 4H, 1H, 15m, 5m, 3m, 1m.
For each timeframe it evaluates:
Color logic
Realtime behavior
Why it’s useful
How it works (under the hood)
Suggested ways to use it
Inputs
EMA Fast / Slow (default 9 / 20)
Use MACD for color (on/off)
MACD Fast / Slow / Signal (default 12 / 26 / 9)
Notes & best practices
Bottom line: MTF Traffic Lights gives you a fast, reliable read on trend + momentum alignment across key timeframes so you can trade with the flow, reduce noise, and time entries with greater confidence.
What it does
This indicator paints a compact “traffic-light” panel in the top-right of your chart showing the trend state on six timeframes: 4H, 1H, 15m, 5m, 3m, 1m.
For each timeframe it evaluates:
- EMA Trend: EMA(9) vs EMA(20)
- (Optional) Momentum Check: MACD histogram (≥0 or ≤0)
Color logic
- Green = EMA(9) > EMA(20) (and MACD hist ≥ 0 if enabled)
- Red = EMA(9) < EMA(20) (and MACD hist ≤ 0 if enabled)
- Yellow = Mixed / disagreement between EMA and MACD (or EMAs roughly equal)
Realtime behavior
- The 1-minute row uses live chart calculations so it can flip intra-bar as price evolves.
- Higher timeframes (3m/5m/15m/1H/4H) are computed on confirmed closes (no lookahead), so they update only when their candle closes—preventing repaint on those rows.
Why it’s useful
- Top-down alignment at a glance: Quickly see if your entry timeframe (1m/3m) is flowing with the “big current” (15m/1H/4H).
- Noise filter: Avoid counter-trend traps by waiting for green-on-green (or red-on-red) alignment before pulling the trigger.
- Momentum confirmation: Enabling the MACD check requires trend and momentum to agree (fewer but higher-quality signals).
- Trade management: Use shifts to yellow as an early heads-up that momentum is diverging from the EMA trend—tighten stops, scale down, or wait for re-alignment.
How it works (under the hood)
- EMAs: Fast = 9, Slow = 20 (fully adjustable).
- MACD: (12, 26, 9) by default; we use the histogram to judge momentum sign.
- Security calls: All higher-TF rows use request.security(..., lookahead_off) to avoid repainting; the 1m row uses the live chart stream for responsiveness.
Suggested ways to use it
- Entry filter: Only take 1m setups when minimum 3 timeframes align ( example 1m + 3m +15min are green; mirror for shorts in red.)
- Regime detection: Treat 4H/1H as the regime "bigger current"; if they’re both red, favor short setups even if lower TFs flicker green.
- Momentum mode: Turn Use MACD ON for stricter confirmation; OFF for a pure EMA view that’s more responsive.
Inputs
EMA Fast / Slow (default 9 / 20)
Use MACD for color (on/off)
MACD Fast / Slow / Signal (default 12 / 26 / 9)
Notes & best practices
- No alerts included: This is a visual dashboard. Pair it with your entry/exit indicator or strategy for alerts and execution.
- Repainting: HTF rows do not repaint (confirmed closes). The 1m row updates intra-bar by design; if you prefer it to wait for close, switch it to a confirmed calculation in code.
- Markets: Works on futures, stocks, FX, and crypto—any symbol supported by TradingView.
Bottom line: MTF Traffic Lights gives you a fast, reliable read on trend + momentum alignment across key timeframes so you can trade with the flow, reduce noise, and time entries with greater confidence.
Phát hành các Ghi chú
MTF Traffic Lights (4H / 1H / 15m / 5m / 3m / 1m)What it does
This indicator paints a compact “traffic-light” panel in the top-right of your chart showing the trend state on six timeframes: 4H, 1H, 15m, 5m, 3m, 1m.
For each timeframe it evaluates:
EMA Trend: EMA(9) vs EMA(20)
(Optional) Momentum Check: MACD histogram (≥0 or ≤0)
Color logic
Green = EMA(9) > EMA(20) (and MACD hist ≥ 0 if enabled)
Red = EMA(9) < EMA(20) (and MACD hist ≤ 0 if enabled)
Yellow = Mixed / disagreement between EMA and MACD (or EMAs roughly equal)
Realtime behavior
Uses live chart calculations so it can flip intra-bar as price evolves.
Why it’s useful
Top-down alignment at a glance: Quickly see if your entry timeframe (1m/3m) is flowing with the “big current” (15m/1H/4H).
Noise filter: Avoid counter-trend traps by waiting for green-on-green (or red-on-red) alignment before pulling the trigger.
Momentum confirmation: Enabling the MACD check requires trend and momentum to agree (fewer but higher-quality signals).
Trade management: Use shifts to yellow as an early heads-up that momentum is diverging from the EMA trend—tighten stops, scale down, or wait for re-alignment.
How it works (under the hood)
EMAs: Fast = 9, Slow = 20 (fully adjustable).
MACD: (12, 26, 9) by default; we use the histogram to judge momentum sign.
Security calls: All higher-TF rows use request.security(..., lookahead_off) to avoid repainting; the 1m row uses the live chart stream for responsiveness.
Suggested ways to use it
Entry filter: Only take 1m setups when minimum 3 timeframes align ( example 1m + 3m +15min are green; mirror for shorts in red.)
Regime detection: Treat 4H/1H as the regime "bigger current"; if they’re both red, favor short setups even if lower TFs flicker green.
Momentum mode: Turn Use MACD ON for stricter confirmation; OFF for a pure EMA view that’s more responsive.
Inputs
EMA Fast / Slow (default 9 / 20)
Use MACD for color (on/off)
MACD Fast / Slow / Signal (default 12 / 26 / 9)
Notes & best practices
No alerts included: This is a visual dashboard. Pair it with your entry/exit indicator or strategy for alerts and execution.
Repainting: HTF rows do not repaint (confirmed closes). The 1m row updates intra-bar by design; if you prefer it to wait for close, switch it to a confirmed calculation in code.
Markets: Works on futures, stocks, FX, and crypto—any symbol supported by TradingView.
Bottom line: MTF Traffic Lights gives you a fast, reliable read on trend + momentum alignment across key timeframes so you can trade with the flow, reduce noise, and time entries with greater confidence.
Phát hành các Ghi chú
removed 4 hour chart.60min, 15min, 5min, 3min & 1min
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.