OPEN-SOURCE SCRIPT

PIGO TREND ATR EXT v2

280
PIGO TREND ATR EXT — Multi-Timeframe Trend, Strength & Exhaustion Dashboard

A comprehensive multi-timeframe analysis tool that combines trend direction,
momentum strength (ADX), volatility (ATR), and statistical exhaustion (Z-score
multilayer) in a single configurable dashboard. Built for traders who need
clear, structured information to identify three distinct setup types: early
continuation, consolidated continuation, and fade at target zones.

🎯 PURPOSE

This indicator solves a fundamental problem in multi-timeframe analysis:
distinguishing healthy trend extension from genuine exhaustion. Traditional
distance-from-EMA metrics produce false exhaustion signals during sustained
trends. This indicator uses a multi-layer Z-score system that filters real
exhaustion from normal trend extension.

📊 HOW IT WORKS

For each configurable timeframe, the indicator displays four metrics:

1. TREND DIRECTION
- 🟢 Uptrend (EMA rising)
- 🔴 Downtrend (EMA falling)
- ⚫️ Neutral (no clear direction)

Two trend identification methods available: direction of single EMA, or
comparison between two EMAs.

2. STRENGTH (FORCE) — ADX-based
- 💪 Strong (ADX above strong threshold)
- 👊 Medium (ADX between thresholds)
- 🤏 Weak (ADX below weak threshold)

Customizable ADX length and threshold values.

3. EXHAUSTION (Z-SCORE MULTILAYER) — The key innovation
- ✅ Normal (no exhaustion detected)
- ⚠️ Warning (one layer triggered)
- 🔥 Extreme (multiple layers confirmed)

Calculated through three independent layers:

Layer 1 — Statistical extension:
Z-score of distance between price and EMA, normalized by historical
standard deviation. Detects positions that are statistically rare for
the instrument's recent behavior, NOT just absolute extension.

Layer 2 — Acceleration:
Compares recent price velocity to average velocity. Detects parabolic
acceleration that typically precedes reversals.

Layer 3 — RSI extreme:
Confirms statistical extreme through traditional RSI overbought/oversold
levels.

The 🔥 signal only triggers when at least 2 of 3 layers align (configurable).
This eliminates the false positives common in single-metric exhaustion
indicators during sustained trends.

4. ATR — Volatility reference
Standard ATR for the timeframe, useful for stop-loss sizing and
position management.

🔄 MULTI-TIMEFRAME ARCHITECTURE

Up to 19 timeframes can be displayed simultaneously, from 1m to Monthly.
Each timeframe is calculated independently using request.security() with
proper context handling. Values remain consistent regardless of which
chart the indicator is applied to.

📋 DASHBOARD

Real-time table displays:
- Timeframe label
- Trend direction (with background color)
- Strength indicator
- Exhaustion indicator with Z-score value (in σ)
- ATR value
- EMA value (optional)

Position and size are fully configurable.

🎯 THREE OPERATIONAL SETUPS IDENTIFIED

This indicator helps identify three distinct trading patterns through specific
combinations of trend, force, and exhaustion readings:

1. EARLY CONTINUATION
Pattern: Trend defined + Force 👊 + Z-score negative (~-1)
Interpretation: Pullback completed after impulse, retest opportunity
Best for: Entry after recent trend change at structural level

2. CONSOLIDATED CONTINUATION
Pattern: Trend defined + Force 💪 + Z-score warning (+1.5 to +2.5σ)
Interpretation: Mature trend with sustained momentum
Best for: Riding established trends with clear momentum

3. FADE AT TARGET ZONE
Pattern: Trend + Force 💪 + Z-score extreme (>+2.8σ) + 🔥
Interpretation: Climax reading at statistical extreme
Best for: Counter-trend entries at Fibonacci targets, prior highs/lows,
or liquidity sweep zones, when combined with technical confluence

⚙️ RECOMMENDED CONFIGURATION

For scalping (NQ, ES, futures):
- EMA Length: 21 (single EMA approach)
- ADX Length: 9, Weak: 18, Strong: 35
- Z-score Lookback: 80
- Z-score Warning: 1.8σ / Extreme: 2.8σ
- Acceleration Threshold: 1.4
- RSI Length: 14, Overbought: 78, Oversold: 22
- Layers Required for 🔥: 2
- Smoothed Close: ON
- Active TFs: 5m, 15m, 1h

For swing trading (4H+):
- EMA Length: 50/200 (two-EMA comparison)
- ADX Length: 14, Weak: 20, Strong: 40
- Z-score thresholds: same as scalping
- Active TFs: 1h, 4h, D, W

🎓 KEY ADVANTAGES OVER TRADITIONAL METHODS

Traditional "distance from EMA in ATRs" methods produce constant 🔥 signals
during strong trends because price naturally stays far from EMA in trending
markets. This creates false exhaustion alerts.

The Z-score multilayer system addresses this by:

1. Normalizing distance against the instrument's OWN recent history
(not absolute values)
2. Requiring acceleration as confirmation (real exhaustion typically
shows parabolic acceleration before reversal)
3. Adding RSI extreme as a third independent filter
4. Requiring multiple layers to align before triggering 🔥

This produces clean, reliable exhaustion signals that align with real
reversal points rather than firing constantly during healthy trends.

🔔 ALERTS

Multiple alert conditions available:
- Trend changes (overall, uptrend start, downtrend start, neutral)
- Multi-timeframe alignments (3D+D+4h, D+4h+1h, 4h+1h+15m, 1h+15m+5m,
15m+5m+3m, 5m+3m+1m)

Useful for setting notifications when specific timeframe combinations align
in the same direction, indicating high-probability continuation setups.

📊 DASHBOARD CUSTOMIZATION

All visual elements are configurable:
- Position (top right, bottom right, middle, etc.)
- Text size (tiny, small, normal, large)
- Background colors per trend state
- Indicator emojis (customizable for each state)
- Show/hide individual columns (Strength, ATR, Extension, EMA value)
- Header on/off
- Active timeframes (toggle each individually)

⚠️ LIMITATIONS

- Requires sufficient historical bars on each timeframe for accurate Z-score
calculation (lookback of 80 bars)
- In extremely illiquid markets, ADX values may be unreliable
- Daily/Weekly timeframe values may need adjustment for instruments with
significant gaps
- Best suited for liquid markets (futures, major forex pairs, large-cap
stocks, major crypto)

🎓 RECOMMENDED USE

This is a context indicator, not an automatic entry trigger. It provides
structured information to help traders identify high-quality setups. For
maximum effectiveness, combine with:

- Technical zone analysis (Fibonacci levels, support/resistance, prior
highs/lows)
- Structural confirmations (Break of Structure, Fair Value Gaps, liquidity
sweeps)
- Multi-timeframe momentum confirmation (e.g., RSI/KDE indicators for
precise timing)

The three-layer exhaustion system specifically helps avoid the most common
fade trading mistake: shorting strong uptrends just because price has moved
"a lot" in absolute terms. Real exhaustion requires statistical rarity,
acceleration, AND momentum extreme — not just distance.

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.