OPEN-SOURCE SCRIPT
已更新 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:




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:
版本注释
What’s New in This UpdateThis update adds a much stronger chart-side workflow to the Heikin Ashi Oscillator Trend Engine.
The oscillator can now be locked to its own candle source with the new Engine Candle Source setting, so the full engine can run from either Regular Candles or TradingView HA independently of the chart’s current candle type. That means the oscillator, MAs, HTF reference, crossovers, and table readings stay more intentional and easier to control.
One of the biggest improvements is how the script now works directly on the main price chart. Traders can now run regular price candles and HA candles together, which makes it much easier to compare real price location against smoother HA structure in real time. Or, if preferred, they can run just the HA overlay by itself for a cleaner structure-focused view. The custom HA Trend Color mode now goes a step further by introducing a streak-based color progression and counter, so HA candles are no longer just on/off bullish or bearish — they also communicate how long that directional run has been building. That makes continuation, strengthening trends, and early shifts easier to read at a glance.
This update also expands the HA chart tools in a big way. You now have a Predictive Close Line drawn on the main chart, HA Trend Circles with Standard and Flips Only modes, and a Regular Close Follow Line that helps show where real price is sitting relative to the smoother HA structure. Together, these additions make the script much more useful for reading live interaction between actual price and HA behavior instead of treating the oscillator pane and chart as separate views.
The Engine Table was also reformatted so the most useful information is easier to read at a glance, including chart candle status, current HA streak, oscillator engine data, active HA Blend preset, and Range Base configuration.
Overall, this is a meaningful usability update. It gives traders more control over how the oscillator is sourced, more flexibility in how price and HA candles are viewed together, and more chart-side context for interpreting trend pressure and structure in real time.
Credit where it’s due: the Heikin Ashi foundation in this script is adapted from SimpleCryptoLife’s open-source work, and this update also includes chart-side inspiration/credit to SimpleCryptoLife for the original predictive close line and HA circle concepts.
版本注释
I apologize for a 2nd update within as many days but I figured I would go ahead and get it out of the way. This *should* be the last one for a while as I feel like I have this script in a great place. Comments welcome on how you're using the script and/or how it's helping you. Also, I am working towards finishing a sibling script that will compliment this oscillator further. It will live in the price chart pane. --
This update expands chart-overlay customization by adding separate body and border transparency controls for the regular price candles, HA Trend Color candles, and HA TV (Trading View) candles. It also keeps the table visually aligned with the selected HA overlay mode: the "Curr HA Streak" row now follows the streak-based HA Trend Color palette in HA Trend Color mode, or the selected HA TV Bullish/Bearish colors in HA TV mode. Defaults of the border/body transparency are set such that it makes the chart easier to read at a glance by giving traders cleaner separation between regular candles and Heikin Ashi candles, while keeping the candle overlays in the price pane and Engine Table speaking the same visual language. Also, the HA candles are default to "Show Last N Bars = 1", so traders initially see just the current HA candle concurrently with the regular candle plots unless the trail is extended across more bars using "Show Last N Bars".
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
🆓 Free scripts:
⚡ Pro scripts: tradingview.com/script/hESCvPuH-Predictive-Volume-MTF-Pro/
🙋♂️ Get help with Pinescript: simplecrypto.life/get-help-with-pinescript
⚡ Pro scripts: tradingview.com/script/hESCvPuH-Predictive-Volume-MTF-Pro/
🙋♂️ Get help with Pinescript: simplecrypto.life/get-help-with-pinescript
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
🆓 Free scripts:
⚡ Pro scripts: tradingview.com/script/hESCvPuH-Predictive-Volume-MTF-Pro/
🙋♂️ Get help with Pinescript: simplecrypto.life/get-help-with-pinescript
⚡ Pro scripts: tradingview.com/script/hESCvPuH-Predictive-Volume-MTF-Pro/
🙋♂️ Get help with Pinescript: simplecrypto.life/get-help-with-pinescript
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。