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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。