Trend Energy Filter
🚀 Trend Energy Filter
Introducing a new dimension in trend analysis: Trend Energy.
In automotive systems (like ECU sensor data), we use hysteresis and noise-gates to prevent "jitter" from triggering false responses.
This script applies that same logic to Momentum (Trend Energy):
ENERGY: Measures the "Engine Load" of the trend by calculating the distance from a long-term SMA.
NOISE FILTER: Uses an ATR-based threshold. The Energy value only updates if the change is significant, effectively filtering out the "market static" that causes false signals.
EXHAUSTION: Detects when the "Fuel" is running out by identifying peaks in energy and subsequent cooling.
While this type of signal processing is often hidden inside expensive commercial "black box" tools, this script provides it as a transparent, open-source engineering solution.
While standard indicators look at price in isolation, the Trend Energy Filter analyzes the "tension" between price and its long-term baseline (SMA). By focusing on the Surface Area of this tension, we gain a visual representation of market conviction that has been largely overlooked by traditional technical analysis.
The Innovation of the "Energy Surface"
Most traders view moving averages as simple static lines. The Trend Energy Filter reimagines the gap between price and the SMA as a dynamic surface.
Volumetric Visualization: Instead of thin lines, the indicator uses a neon-glow "Surface" with vertical gradients. This represents the total "Energy" currently held by the trend.
Volatility-Adjusted Noise Filter: Unlike standard oscillators that whipsaw during consolidation, this script utilizes a state-persistent ATR filter. It only updates the "Surface" when market energy moves significantly, effectively silencing the noise of minor price fluctuations.
XAUUSD 15min
Peak-Based Exhaustion Logic: By tracking the Highest energy peaks over a lookback period, the script identifies when a trend's "batteries" are running low—turning the surface blue when momentum begins to stall.
How to Trade with the Energy Surface:
1. Entering the Energy Flow (Momentum Resumption)
Watch for the "Surface" to break above its previous peak. When the color shifts from the "Exhaustion Blue" back to a vibrant Bullish Green or Bearish Red, it signals that the market has finished its rest and is ready to expand the surface area again.
NAS100 15min
Signal: Momentum Increasing alert.
2. Spotting the Blow-Off (Exhaustion Detection)
When the "Surface" is high but begins to contract (falling below its recent high), the trend is becoming "over-extended" or "exhausted." This is the ideal time to take profits or tighten trailing stops.
Visual: The surface turns blue (#5b9cf6) while still at high levels.
NAS100 15 min
3. The Squeeze (Energy Compression)
When the Energy Surface is exceptionally low and the Noise Filter prevents it from fluctuating, the market is in a "coiled spring" state. A sudden expansion of the surface from a flat baseline often precedes a massive directional breakout.
NAS100 15min
4. Baseline Context
Green Surface: Price is above the 200 SMA (Bullish Energy).
Red Surface: Price is below the 200 SMA (Bearish Energy).
Blue Surface: Trend is pausing or mean-reverting (Exhaustion).
Pine Script® indicator






















