OPEN-SOURCE SCRIPT

EMA Horizon

567
OVERVIEW

The EMA Horizon indicator offers a modern, structural upgrade to the classic Exponential Moving Average. While standard EMAs are indispensable tools for trend identification, they inherently suffer from "live candle blindness"—flickering wildly on the current unclosed bar and causing traders to miss critical intraday touches or fall into false breakout traps.

EMA Horizon solves this by calculating an immediate forward-looking volatility corridor based on the asset's actual physical extremes (High/Low), anchored tightly to its closing history. It provides an unchanging, reliable boundary range for the current candle asset space, allowing traders to see exactly where the EMA would be pushed under extreme conditions.

---

THE PROBLEM WITH STANDARD EMAs

A standard EMA updates continuously based on the live ticking close. During highly volatile periods, the indicator line bends and flexes dramatically inside the current bar. This real-time distortion creates two major issues:

  1. The Flicker Trap: Price can spike out of an EMA zone and snap back before the candle closes, leaving no historical trace of the breach and causing missed execution opportunities.
  2. Lagging Boundaries: Standard bands (like envelopes or Keltner channels) look backward at historical averages. They fail to tell you how a single massive, aggressive live expansion bar will mathematically impact the underlying moving average trend line right now.


---

THE SOLUTION & MECHANICAL EDGE

EMA Horizon does not simply calculate an EMA of all Highs or all Lows (which smoothly degrades accuracy over time). Instead, it preserves the integrity of pure historical closing prices up to the immediate moment.

From that clean historical baseline, it executes a "one-off" look-ahead calculation: it processes the current candle's High and Low as if they were the immediate next closing prices.

  • The High Band shows the ultimate ceiling the EMA could reach on the next step.
  • The Low Band shows the absolute floor the EMA could drop to on the next step.


By utilizing the built-in Bands Offset parameter, you can shift this entire calculation forward across your timeline. When shifted, the boundaries sitting under your live candle are locked—derived entirely from the previous candle's completed structure. This eliminates real-time repainting and gives you an unshakeable roadmap for price interaction.

---

FEATURES

  • Pure History Anchoring: The base EMA line relies strictly on closing prices, ensuring your core trend logic remains untainted by extreme wicks.
  • Next-Bar Step Simulation: Dynamically maps out the mathematical limits of the moving average based on immediate price expansion boundaries.
  • Global Visual Alignment: The script features a unique global offset parameter that shifts both the baseline EMA and its projection bands uniformly. This completely avoids visual distortion and allows you to perfectly map historical structures without losing physical perspective.


---

HOW TO USE

  1. Add to Chart: Search for "EMA Horizon" in your TradingView indicator panel and apply it.
  2. Configure your Length: Adjust the Length input to match your primary trend tracking asset class (e.g., 9 for short-term momentum, 21 or 50 for structural trends).
  3. Set your Offset Look:
    • Set Bands Offset to 0 to observe the real-time maximum range expansion matching the current candle's high/low.
    • Set Bands Offset to 1 to push the indicator one bar to the right. This allows you to track how the current live asset price responds to the locked, unchangeable projection generated by the previous closed bar.
  4. Identify True Deviations: Watch for instances where a candle aggressively drives through the green horizon cloud. If the asset price slices cleanly past the projected bands, it indicates an exhaustion phase or an institutional velocity breakout that goes beyond standard mathematical trend boundaries.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน