OPEN-SOURCE SCRIPT
업데이트됨 EMA Cluster Absorption Engine [KNN Engine]

EMA Cluster Absorption Engine [KNN Engine]
1. What the Script Does
The EMA Cluster Absorption Engine is a high-sensitivity momentum and consensus oscillator designed to identify sharp, momentum-driven reversals (often referred to as "V-Bottoms" or "V-Tops"). It moves beyond standard moving averages by evaluating price action across 24 simultaneous Exponential Moving Average (EMA) time-horizons.
Furthermore, it introduces a built-in K-Nearest Neighbors (KNN) Machine Learning Algorithm to calculate the statistical probability of a mean-reversion bounce based on historical market data.
Rather than relying on a single, arbitrary EMA length, this indicator mathematically aggregates 24 distinct momentum cycles to verify if the entire institutional ecosystem is overextended. It visualizes this data through a dynamically scaling histogram, a multi-ribbon fan, and volatility boundaries.
2. The Core Innovation: How it Calculates Everything
Standard moving averages rely on fixed lookback periods (e.g., a 50-EMA), which inherently lag the market and drop relevant historical data. This script is fundamentally original because it abandons fixed lookbacks in favor of Anomaly Anchoring, Expanding EMA Recursion, and Predictive Classification.
Anomaly Anchoring: The engine constantly scans volume for statistical deviations. When it detects a volume spike exceeding a 2.5 Z-Score, it drops a mathematical "Anchor." It tracks the last 24 of these institutional liquidity events simultaneously.
Expanding EMA Recursion: From each of the 24 anchor points, the script begins calculating an independent EMA. Unlike fixed EMAs, these use an "Expanding Alpha" ($\alpha = 2 / (count + 1)$), making them incredibly sensitive to the initial impulse of a new trend while maintaining the memory of the anchor point.
The Consensus Meta-Mean: The script calculates the absolute average of all 24 active EMA lines. This "Meta-EMA" represents the true equilibrium of the market's current momentum. The distance of price from this average is converted into a Z-Score, standardizing the deviation across any asset class.
The K-Nearest Neighbors (KNN) Engine: When the script detects 100% Consensus (e.g., all 24 active EMAs are simultaneously above or below price), it captures the exact numerical fingerprint of the market (EMA Deviation, EMA Velocity, and Price Velocity). The KNN engine calculates the Euclidean Distance between the current fingerprint and the last 300 historical fingerprints. It finds the 5 nearest neighbors (the 5 times history looked mathematically identical) and checks their win/loss results to generate a live probability score.
3. Justifying the Methodology
Why combine 24 expanding EMAs with a KNN machine learning model? Because fast-moving markets frequently outrun standard indicators.
In high-volatility environments, traditional simple moving averages (SMAs) lag too much to catch the absolute bottom or top. EMAs hug price closer, making them the preferred benchmark for momentum algorithms. By anchoring 24 separate EMAs to actual volume anomalies, we verify if the entire market ecosystem—even the most sensitive momentum metrics—agrees on the overextension. By passing that data through a KNN algorithm, we filter out low-quality traps by asking the data: "The last 5 times momentum snapped this aggressively, did price successfully reverse by at least 0.1%?"
4. How to Use the Indicator
Visual Layout:
The Structural Fan (Ribbons): 24 individual EMA lines plotted on a standardized Z-axis. When tightly compressed, momentum is structurally unanimous. When fanned out, momentum is decaying or conflicted.
The Engine Histogram: Visualizes the standardized deviation of price from the Meta-EMA.
Expansion (Bright): Bright Blue or Bright Lime/Red bars indicate that momentum is actively accelerating away from equilibrium.
Contraction (Dark): Dark, highly transparent bars indicate that momentum is decaying or cooling off back toward the zero-line.
Tactical Trade Execution:
Spot the Momentum Purge: Watch the histogram expand into extreme territory (Lime for bullish potential, Red for bearish potential). Because this is an EMA engine, this happens when price moves faster than the institutional momentum "gas" can follow. Do not enter yet.
Wait for the Machine Learning Confirmation: Wait for the background to flash Lime (Bullish) or Red (Bearish) with a printed percentage (e.g., 80%). This means the KNN algorithm has verified that identical historical momentum snaps successfully reversed price.
The Trigger: Wait for the white Signal Line to peak (often printing an Exhaustion ✧ marker) and begin receding back toward the zero-line, ultimately "re-enveloping" the histogram bars. This confirms that the extreme directional friction has officially snapped, signaling a high-probability mean reversion.
1. What the Script Does
The EMA Cluster Absorption Engine is a high-sensitivity momentum and consensus oscillator designed to identify sharp, momentum-driven reversals (often referred to as "V-Bottoms" or "V-Tops"). It moves beyond standard moving averages by evaluating price action across 24 simultaneous Exponential Moving Average (EMA) time-horizons.
Furthermore, it introduces a built-in K-Nearest Neighbors (KNN) Machine Learning Algorithm to calculate the statistical probability of a mean-reversion bounce based on historical market data.
Rather than relying on a single, arbitrary EMA length, this indicator mathematically aggregates 24 distinct momentum cycles to verify if the entire institutional ecosystem is overextended. It visualizes this data through a dynamically scaling histogram, a multi-ribbon fan, and volatility boundaries.
2. The Core Innovation: How it Calculates Everything
Standard moving averages rely on fixed lookback periods (e.g., a 50-EMA), which inherently lag the market and drop relevant historical data. This script is fundamentally original because it abandons fixed lookbacks in favor of Anomaly Anchoring, Expanding EMA Recursion, and Predictive Classification.
Anomaly Anchoring: The engine constantly scans volume for statistical deviations. When it detects a volume spike exceeding a 2.5 Z-Score, it drops a mathematical "Anchor." It tracks the last 24 of these institutional liquidity events simultaneously.
Expanding EMA Recursion: From each of the 24 anchor points, the script begins calculating an independent EMA. Unlike fixed EMAs, these use an "Expanding Alpha" ($\alpha = 2 / (count + 1)$), making them incredibly sensitive to the initial impulse of a new trend while maintaining the memory of the anchor point.
The Consensus Meta-Mean: The script calculates the absolute average of all 24 active EMA lines. This "Meta-EMA" represents the true equilibrium of the market's current momentum. The distance of price from this average is converted into a Z-Score, standardizing the deviation across any asset class.
The K-Nearest Neighbors (KNN) Engine: When the script detects 100% Consensus (e.g., all 24 active EMAs are simultaneously above or below price), it captures the exact numerical fingerprint of the market (EMA Deviation, EMA Velocity, and Price Velocity). The KNN engine calculates the Euclidean Distance between the current fingerprint and the last 300 historical fingerprints. It finds the 5 nearest neighbors (the 5 times history looked mathematically identical) and checks their win/loss results to generate a live probability score.
3. Justifying the Methodology
Why combine 24 expanding EMAs with a KNN machine learning model? Because fast-moving markets frequently outrun standard indicators.
In high-volatility environments, traditional simple moving averages (SMAs) lag too much to catch the absolute bottom or top. EMAs hug price closer, making them the preferred benchmark for momentum algorithms. By anchoring 24 separate EMAs to actual volume anomalies, we verify if the entire market ecosystem—even the most sensitive momentum metrics—agrees on the overextension. By passing that data through a KNN algorithm, we filter out low-quality traps by asking the data: "The last 5 times momentum snapped this aggressively, did price successfully reverse by at least 0.1%?"
4. How to Use the Indicator
Visual Layout:
The Structural Fan (Ribbons): 24 individual EMA lines plotted on a standardized Z-axis. When tightly compressed, momentum is structurally unanimous. When fanned out, momentum is decaying or conflicted.
The Engine Histogram: Visualizes the standardized deviation of price from the Meta-EMA.
Expansion (Bright): Bright Blue or Bright Lime/Red bars indicate that momentum is actively accelerating away from equilibrium.
Contraction (Dark): Dark, highly transparent bars indicate that momentum is decaying or cooling off back toward the zero-line.
Tactical Trade Execution:
Spot the Momentum Purge: Watch the histogram expand into extreme territory (Lime for bullish potential, Red for bearish potential). Because this is an EMA engine, this happens when price moves faster than the institutional momentum "gas" can follow. Do not enter yet.
Wait for the Machine Learning Confirmation: Wait for the background to flash Lime (Bullish) or Red (Bearish) with a printed percentage (e.g., 80%). This means the KNN algorithm has verified that identical historical momentum snaps successfully reversed price.
The Trigger: Wait for the white Signal Line to peak (often printing an Exhaustion ✧ marker) and begin receding back toward the zero-line, ultimately "re-enveloping" the histogram bars. This confirms that the extreme directional friction has officially snapped, signaling a high-probability mean reversion.
릴리즈 노트
Blue/Red histogram that matches my other indicators오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.