Created
August 1, 2025 06:53
-
-
Save HoraceBury/fd8a5d01a2542a47fba90ed71022967d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=6 | |
indicator("Heikin-Ashi Pane", overlay=false, shorttitle="HA") | |
// === Calculate Heikin-Ashi values === | |
ha_close = (open + high + low + close) / 4 | |
var float ha_open = na | |
ha_open := na(ha_open[1]) ? (open + close) / 2 : (ha_open[1] + ha_close[1]) / 2 | |
ha_high = math.max(high, math.max(ha_open, ha_close)) | |
ha_low = math.min(low, math.min(ha_open, ha_close)) | |
// === Colors === | |
isBull = ha_close >= ha_open | |
bullColor = input.color(color.green, "Bullish Candle Color") | |
bearColor = input.color(color.red, "Bearish Candle Color") | |
candleColor = isBull ? bullColor : bearColor | |
// === Plot Heikin-Ashi candles in subpane === | |
plotcandle( | |
open=ha_open, | |
high=ha_high, | |
low=ha_low, | |
close=ha_close, | |
title="Heikin-Ashi Candles", | |
color=candleColor | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment