OPEN-SOURCE SCRIPT
Auto-Lensed MACD + Z-Score v8.2

The AL-MACD represents a departure from static technical analysis. While traditional oscillators use fixed mathematical constants, this indicator treats the market as a living, breathing cycle that requires a dynamic "Lens" to view clearly.
1. The Core Innovation: The Adaptive Lens
Standard MACDs are often "too fast" in volatile markets (causing noise) or "too slow" in trending markets (causing lag).
How it works: The script constantly measures the distance between recent price pivots to determine the Market Tempo.
The Result: It automatically recalculates its own Fast, Slow, and Signal lengths. If the market cycle compresses, the MACD tightens to catch the move; if the cycle expands, the MACD smooths out to avoid fakeouts.
2. Statistical Extremity (Z-Score Integration)
We integrated a price-based Z-Score (Standard Deviation) logic to provide a "Mean Reversion" layer.
Normalization: The Z-Score is normalized to the MACD scale so that the threshold bands breathe with the momentum.
Exhaustion Coloring: The histogram turns Aqua or Magenta when the price is statistically overextended (sigma>2.0 SD). This tells you a move is "out of breath" even before a reversal begins.
3. Signal Intelligence & Noise Reduction
To solve the "dot cluster" problem common in divergence indicators, we implemented a Quiet Build architecture:
ATR Magnitude Filter: Divergences are ignored if the price move between pivots is too small to be significant.
Signal Cooldown: A mandatory "rest period" (default 15 bars) prevents the script from firing repeated signals during a slow grind.
Slope Filter: Ignores signals if the MACD momentum is essentially flat.
4. Visual Interface & Dashboard
The Dashboard: Provides a real-time "Flight Deck" including Lens Speed, Price Z-Score, and current Adaptive Lengths.
Timeframe Recommendations: A dynamic "Rec Pivot" feature that tells the user exactly which structural settings to use based on the current chart interval (15s vs. Daily).
Sniper Alerts: A confluence-based alert system that only triggers when a Divergence meets a Z-Score extremity—the "A+ Setup."
5. Strategy Cheat Sheet
Signal
Market Context
Action
Histogram Color Shift
Z-Score sigma> 2.0
Alert: Market is overextended.
"R" Triangle + Magenta/Aqua
Divergence at Extremity
Entry: High-conviction mean reversion (The Sniper).
Rising Lens Speed
Cycle lengths are increasing
Wait: Market is entering a slow, trending grind.
Falling Lens Speed
Cycle lengths are decreasing
Prep: Volatility is coiling; expect a fast move.
1. The Core Innovation: The Adaptive Lens
Standard MACDs are often "too fast" in volatile markets (causing noise) or "too slow" in trending markets (causing lag).
How it works: The script constantly measures the distance between recent price pivots to determine the Market Tempo.
The Result: It automatically recalculates its own Fast, Slow, and Signal lengths. If the market cycle compresses, the MACD tightens to catch the move; if the cycle expands, the MACD smooths out to avoid fakeouts.
2. Statistical Extremity (Z-Score Integration)
We integrated a price-based Z-Score (Standard Deviation) logic to provide a "Mean Reversion" layer.
Normalization: The Z-Score is normalized to the MACD scale so that the threshold bands breathe with the momentum.
Exhaustion Coloring: The histogram turns Aqua or Magenta when the price is statistically overextended (sigma>2.0 SD). This tells you a move is "out of breath" even before a reversal begins.
3. Signal Intelligence & Noise Reduction
To solve the "dot cluster" problem common in divergence indicators, we implemented a Quiet Build architecture:
ATR Magnitude Filter: Divergences are ignored if the price move between pivots is too small to be significant.
Signal Cooldown: A mandatory "rest period" (default 15 bars) prevents the script from firing repeated signals during a slow grind.
Slope Filter: Ignores signals if the MACD momentum is essentially flat.
4. Visual Interface & Dashboard
The Dashboard: Provides a real-time "Flight Deck" including Lens Speed, Price Z-Score, and current Adaptive Lengths.
Timeframe Recommendations: A dynamic "Rec Pivot" feature that tells the user exactly which structural settings to use based on the current chart interval (15s vs. Daily).
Sniper Alerts: A confluence-based alert system that only triggers when a Divergence meets a Z-Score extremity—the "A+ Setup."
5. Strategy Cheat Sheet
Signal
Market Context
Action
Histogram Color Shift
Z-Score sigma> 2.0
Alert: Market is overextended.
"R" Triangle + Magenta/Aqua
Divergence at Extremity
Entry: High-conviction mean reversion (The Sniper).
Rising Lens Speed
Cycle lengths are increasing
Wait: Market is entering a slow, trending grind.
Falling Lens Speed
Cycle lengths are decreasing
Prep: Volatility is coiling; expect a fast move.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.