OPEN-SOURCE SCRIPT
Heiken Ashi Trend Line

Heiken Ashi Trend Line
Heiken Ashi candles are great for reading trend, but you lose the real price action in exchange for the smoothing. This indicator gives you the best of both: keep your regular candles on the chart, and overlay a single line that tracks the Heiken Ashi trend.
What it plots
A single line drawn at the midpoint of the Heiken Ashi body (the average of HA Open and HA Close). The line is colored green when the current HA candle would be green (HA Close ≥ HA Open) and red when it would be red. You get the HA trend signal without giving up real candle visibility.
Why the midpoint
The midpoint of the HA body smooths naturally because HA Open is itself a running average of prior HA values. Mixing it with HA Close produces a line that tracks price closely but with less noise than a raw close-based plot. No length parameter required, no arbitrary smoothing to tune.
Offset setting
An adjustable offset (as a percentage of price) lets you shift the line above or below your candles so it doesn't overlap the price action. Percentage-based scaling means the same setting looks consistent across any ticker. 0.1% is visually similar on SPY as it is on a $20 stock. Set to 0 to keep it anchored to price, positive to push it above, negative to push it below.
How to use
Works on any ticker and any timeframe. No configuration required
Use the color to read trend direction at a glance
Use the slope as confirmation of momentum strength
Pairs well with your existing setups since it doesn't clutter the chart
A note on transition bars
On bars where HA flips direction, the line's slope may briefly disagree with its color. This is the Heiken Ashi math being honest. HA Open on the first bar of a new direction is anchored near the prior body. It's rare and it's not a bug.
Heiken Ashi candles are great for reading trend, but you lose the real price action in exchange for the smoothing. This indicator gives you the best of both: keep your regular candles on the chart, and overlay a single line that tracks the Heiken Ashi trend.
What it plots
A single line drawn at the midpoint of the Heiken Ashi body (the average of HA Open and HA Close). The line is colored green when the current HA candle would be green (HA Close ≥ HA Open) and red when it would be red. You get the HA trend signal without giving up real candle visibility.
Why the midpoint
The midpoint of the HA body smooths naturally because HA Open is itself a running average of prior HA values. Mixing it with HA Close produces a line that tracks price closely but with less noise than a raw close-based plot. No length parameter required, no arbitrary smoothing to tune.
Offset setting
An adjustable offset (as a percentage of price) lets you shift the line above or below your candles so it doesn't overlap the price action. Percentage-based scaling means the same setting looks consistent across any ticker. 0.1% is visually similar on SPY as it is on a $20 stock. Set to 0 to keep it anchored to price, positive to push it above, negative to push it below.
How to use
Works on any ticker and any timeframe. No configuration required
Use the color to read trend direction at a glance
Use the slope as confirmation of momentum strength
Pairs well with your existing setups since it doesn't clutter the chart
A note on transition bars
On bars where HA flips direction, the line's slope may briefly disagree with its color. This is the Heiken Ashi math being honest. HA Open on the first bar of a new direction is anchored near the prior body. It's rare and it's not a bug.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.