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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。