CNE - Efficient Swing Structure + MomentumThe CNE Efficient Swing Structure and Momentum indicator is a sophisticated technical analysis tool designed to quantify the strength and exhaustion of price movements relative to genuine market structure rather than arbitrary time constraints. Unlike traditional oscillators that reset based on a fixed number of candles, this indicator anchors its calculations to confirmed structural pivots. The foundation of the system is a volatility-adaptive swing detection algorithm that utilizes the Average True Range (ATR) to filter out insignificant noise. A trend change is only registered when price retraces against the current direction by a user-defined multiple of the ATR, ensuring that the tool remains locked onto the prevailing trend until a statistically significant reversal occurs. This mechanism allows the trader to view momentum as a cumulative force continuously building from a verified low or high, providing a pure view of the current leg's intensity.
Once a structural anchor is established, the indicator calculates the "Pivot-to-Pivot" momentum, displaying the percent change from the start of the trend to the current price. This creates a zero-based oscillator where the zero line represents the structural origin—the absolute bottom of the current uptrend or the absolute top of the current downtrend. To contextualize this raw data, the script overlays dynamic statistical bands based on standard deviations. These bands function similarly to Bollinger Bands but are applied to the momentum of the swing itself. When the momentum histogram pushes into the outer deviation bands, specifically beyond two standard deviations, it signals that the current move is statistically overextended relative to the asset's recent volatility profile. This helps traders distinguish between a healthy, sustainable trend and a climactic move that is prone to a mean-reversion snapback.
A critical feature of this system is its ability to visualize the "average extension" of market moves, providing an immediate benchmark for trade management and target setting. The indicator plots two distinct sets of lines for both upward extensions and downward drawdowns without relying on heavy historical arrays, ensuring optimal computational efficiency. The first is a solid step-line representing the historical average of all past swings, serving as a long-term baseline for what constitutes a "normal" move. The second is a dotted marker representing a recency-weighted average, heavily biased toward the last five swings. By comparing these two lines, a trader can instantly gauge the changing market regime; if the recent weighted average is expanding away from the historical baseline, volatility is increasing, whereas a contracting recent average suggests the market is entering a period of compression.
Finally, the indicator integrates automated divergence detection based on structural flips rather than simple candle-to-candle comparisons. It records the peak momentum value of every completed trend leg and compares it to the peak of the previous leg in the same direction. If price makes a new structural high but the momentum oscillator fails to surpass the peak of the previous uptrend leg, a bearish divergence is flagged. Conversely, if price pushes to a new structural low with weaker downside momentum than the prior drop, a bullish divergence is highlighted. This combination of volatility-filtered structure, statistical deviation bands, efficiency-optimized extension targets, and structural divergence creates a comprehensive framework for assessing the probability of trend continuation versus reversal.
Pine Script® indicator






















