PROTECTED SOURCE SCRIPT

EMA Trend Regime Filter by Jaehee

56
Overview

This indicator defines bullish/bearish regimes using a five-EMA stack and emits one signal per confirmed regime flip. Optional ATR gap gating and an ADX gate require structure and strength before a switch is confirmed. An optional, subtle center line improves readability. This is not a strategy and it does not execute trades.
Note: This tool is not the ATR-based Supertrend; it uses EMA stacking with ATR/ADX gating.

Why this combination (originality & value)

• EMA stacking provides a clear directional framework.
• ATR gap gating filters compressed/fragile stacks by requiring each adjacent EMA distance to exceed ATR × multiplier.
• A state machine limits signals to one per direction change, reducing alert fatigue.
• Confirm bars + ADX gate elevate the quality of regime recognition under directional pressure.
Together, these components interact to emphasize durable regime shifts while curbing noise typical of sideways phases.

How it works (concept)

EMA stack: Bullish when EMA1 > EMA2 > EMA3 > EMA4 > EMA5; bearish is the reverse.

ATR spacing (optional): When enabled, each EMA gap must exceed ATR × k to qualify for a flip.

Confirmation streak: Conditions must persist for confirmBars before a flip is validated.

Trend-strength gate: A flip is allowed only when ADX ≥ adxMin.

Flip & signal: On validation, a single marker/label is emitted; duplicates are suppressed.

Visual layer (optional): Subtle background/center line for context; visuals do not affect logic.

Why it’s useful
• Regime clarity: A binary bullish/bearish state reduces decision fatigue and aligns your playbook with market context.
• Counter-trend filter: In a bullish regime, counter-trend shorts are discouraged; in a bearish regime, counter-trend longs are discouraged—until the regime flips.
• Signal economy: One signal per confirmed flip helps avoid alert fatigue and over-trading.
• Volatility awareness: ATR gap gating filters compressed EMA stacks that often precede whipsaws.
• Strength confirmation: The ADX gate requires directional pressure before a switch is allowed.

Practical workflows (how it can be used)
• HTF compass (e.g., H4): Use a higher timeframe such as the 4-hour chart to set directional bias; execute on your lower timeframe with your own triggers and risk rules.
• Alignment rule: Trade in the direction of the active regime—prefer long setups during a bullish regime and short setups during a bearish regime—until a confirmed flip occurs.
• Pullback playbook: In a bullish regime, consider pullbacks to structure/MA confluence; in a bearish regime, consider rallies into resistance. Always size risk independently of the indicator.
• Parameter tuning: Adapt confirmBars, ATR × multiplier, and ADX minimum to the instrument’s volatility. Higher thresholds generally reduce noise but may delay flips.
• Alerts/automation: Set alerts on regime flips but confirm on bar close; intrabar values can update.

Context note (BTC, H4)
On higher timeframes such as the 4-hour chart, trends are often more stable. For BTC, the regime can help distinguish whether the broader market is trending up or down: when the H4 regime is bullish, favor long-side opportunities even if lower-timeframe candles retrace; when the regime turns bearish, favor short-side opportunities. This is context, not signals—entries/exits and risk management remain your responsibility.

Key inputs
• EMA lengths (1–5), Confirm Bars, Min Spacing by ATR
• ADX Length, ADX Minimum
• Visualization toggles (background opacity, center line, label/marker colors)

Alerts
• EMA REGIME LONG — fires once on a confirmed bullish regime
• EMA REGIME SHORT — fires once on a confirmed bearish regime

Notes & limitations
• Designed without future-bar references. Values can update intrabar, so confirm on close before acting on signals.
• This is an indicator for study purposes; it does not place trades.
• Parameters may require tuning across symbols/timeframes.
• Publish with a clean chart so the indicator’s output is clearly identifiable.
• Use on standard bar types (e.g., candles). Non-standard chart types can yield unrealistic behavior for signal logic.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.