PROTECTED SOURCE SCRIPT

Distance from 200 EMA (HUD)

25
What it does:
A minimal, on-chart heads-up display that shows the real-time percentage distance between price and the 200-period EMA on your current timeframe. No lower pane, no clutter—just a small box in the top-right with “Distance from 200 EMA” and the live % value.

Why it’s useful:

Quickly quantify trend and extension: positive values = price above the 200 EMA; negative values = below.

Spot overextension and potential mean-reversion zones without measuring by hand.

Keep the chart clean while maintaining constant awareness of how stretched price is from the long-term mean.

How it works
The indicator calculates (Close − EMA(200)) / EMA(200) × 100 on whatever timeframe your chart is set to, then displays that percentage as a compact table overlay. It updates in real time as price and timeframe change.

Typical use cases

Trend filter: trade with the primary bias (above = long bias, below = short bias).

Extremes & pullbacks: define your own “extreme” thresholds (e.g., ±X%) to allow counter-trend fades or to anticipate pullbacks toward the EMA.

Multi-timeframe alignment: flip between H1/H4/D1 and instantly see extension on each timeframe.

Settings

EMA Length (default 200)

Decimals (rounding)

Color by sign (optional green/red background)

Notes

Works on any market and timeframe supported by TradingView.

The value is percentage distance, not pips or ticks.

Pair it with your price-action tools (swing highs/lows, liquidity levels) and volume/OI reads for higher-quality decisions.

Risk reminder
This is an information tool, not a signal generator. Manage risk strictly (I risk ≤1% per trade by default).

If you find this helpful:

❤️ Boost the script

⭐ Follow my profile for more tools

💬 Comment with feedback or feature ideas

🔗 Considering TradingView? Use my referral link tradingview.com/pricing/?share_your_love=Trading_Soldier to support the work—thank you!

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.