Heikin Ashi Oscillator Trend Engine At its core, this script is a Heikin Ashi-based oscillator designed to translate HA candle behavior into a normalized momentum framework that is easier to read in a separate pane. Instead of only viewing Heikin Ashi candles on price, this script converts HA-derived range behavior into an oscillator that can help show direction, expansion, contraction, and structural shifts in a more organized way. The goal is not just to turn HA into another oscillator. The goal is to build a unified HA engine that can be read through multiple layers while still staying tied to the same foundation.
The script includes two core engine modes:
HA Range Base
This is the more direct and responsive version. It builds the oscillator from signed Heikin Ashi range behavior, then smooths that result into a cleaner momentum read.
HA Blend
This mode keeps the same HA foundation, but blends multiple smoothed HA range relationships together into one output. The result is often smoother and more refined while still staying rooted in Heiken Ashi structure.
That distinction matters because this is not a random stack of unrelated features. Everything in the script is built around the same central idea: use Heikin Ashi-derived behavior as the base signal, then offer different ways to normalize it, smooth it, visualize it, and compare it across timeframes.
The script also includes a normalization layer. A dynamic/manual lookback framework controls the reference window used for normalization and adaptive guide logic, so the oscillator can stay more balanced across different chart speeds. The output is then organized into a broader interpretation framework that includes:
➖ adaptive fast/slow crossover lines
➖ a separate SMA 20 / 50 crossover engine
➖ a rolling oscillator VWA for participation-aware context
➖ a stabilized higher-timeframe oscillator reference line
➖ a pivot-based trend overlay built from confirmed oscillator pivots
➖ adaptive zero / ±50 guide lines
➖ synthetic oscillator candles
➖ a histogram pressure envelope state engine and fill that highlights when the oscillator pushes into user-defined extreme zones inside the pane
➖ optional price-overlay candles that reuse the same oscillator color logic
➖ a compact engine table for quick reference
These are not separate systems bolted on for the sake of adding more features. They are different ways of reading the same Heiken Ashi oscillator engine.
A practical way to think about it:
➡️ When the oscillator is above zero and strengthening, HA-based momentum is expanding in the bullish direction.
➡️ When it is above zero but weakening, the move may still be positive, but the internal pace is cooling.
➡️ When it is below zero and weakening further, bearish pressure is expanding.
➡️ When it is below zero but improving, downside pressure may be easing even if the broader condition is still negative.
The higher-timeframe oscillator line adds another layer of context. It gives you a way to compare the local pane oscillator against the next broader HA context. That can help answer whether the current move is flowing with the higher-timeframe structure or starting to diverge from it.
The pivot overlay serves a different purpose. Rather than acting like another moving average, it behaves more like a structural reference derived from confirmed oscillator pivots. That can make it useful for traders who want a more regime-style guide instead of relying only on crossover behavior.
The synthetic oscillator candles are there to make bar-to-bar behavior easier to read. They can help show when the oscillator is expanding, slowing, or shifting direction more clearly than a line alone. The optional price-overlay candle mode extends that same color logic back onto the main chart so pane-space and chart-space stay visually connected.
This script is not meant to predict reversals by itself, and it should not be treated as a stand-alone signal machine. The way I use it is more practical:
➖ to judge whether HA-based momentum is expanding or contracting
➖ to compare local oscillator behavior against higher-timeframe context
➖ to see whether momentum is strengthening, stalling, or rotating
➖ to keep price-space and pane-space context visually aligned
Bar Replay
Bar Replay is especially useful here. Watching the oscillator build one bar at a time makes it much easier to understand how the HA engine responds to expansion and contraction, how the crossover layers behave during transitions, and how the pivot overlay changes only after structure is confirmed.
Confluence
Like most momentum tools, this works best with confluence. I would not use it in isolation. It becomes more useful when paired with structure, support/resistance, volume, trend context, RSI, or other confirmation tools. The value of this script is not that it replaces those tools. The value is that it gives Heiken Ashi behavior a more organized oscillator-based expression that can be easier to compare, normalize, and monitor over time.
A few example charts:
Indicador Pine Script®






















