OPEN-SOURCE SCRIPT

ATR Based Zigzag w EMA

2 488
The "ATR Based Zigzag with EMA" indicator is a refined trend-following tool designed for traders who demand clarity, precision, and robust trend detection. This script uses an ATR (Average True Range)-based breakout mechanism to dynamically determine the current market trend, while overlaying a clean, smoothed EMA (Exponential Moving Average) line to visually represent the active directional bias.

The indicator continuously tracks new swing highs and lows based on ATR volatility thresholds. When price moves sufficiently against the current trend — exceeding an ATR-multiplied distance — the trend is considered reversed. This adaptive method ensures that trend flips are based not on arbitrary price action, but on meaningful, volatility-adjusted movements.

Instead of plotting zigzag-style pivots which can create visual noise, the indicator draws a single, smooth EMA line calculated from the median price ((high + low) / 2). The color of the line shifts instantly based on the active trend: green (or your customized color) for uptrends, and red for downtrends. In addition, individual price bars are optionally colored to match the trend, further enhancing at-a-glance clarity without cluttering the chart.

Key user-defined inputs include the ATR length, ATR multiplier (sensitivity for trend flips), EMA smoothing length (responsiveness of the trend line), and full color customization for uptrend and downtrend states.

This indicator excels at providing a clear and immediate understanding of trend conditions, making it highly effective for:

Trend-following strategies

Reversal spotting based on volatility breaks

Entry/exit confirmation

Visual chart cleanliness and minimalism

Whether used standalone or alongside other tools, the "ATR Based Zigzag with EMA" offers a disciplined, volatility-sensitive view of market structure — engineered for traders who refuse to tolerate noise, hesitation, or ambiguity in their decision-making.

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.