Set a Heikin Ashi color-change alert on a regular chart
The indicator explicitly requests the Heikin Ashi series while leaving standard prices on the chart. Use the same symbol, session and timeframe for any visual check. On a Heikin Ashi comparison chart, leave Color bars based on previous close off so the displayed body color matches the script’s open-versus-close rule.
- Open a standard Candles chart for your intended dated futures contract and choose the interval and session you want the alert to use.
- Open Pine Editor, paste the indicator below into a new script, save it, and add it to the chart. The markers show the closed bars that meet the condition.
- Open Create alert and choose HA body direction at close under Condition. Pick HA turned up or HA turned down. Create one alert per direction if you want both.
- Choose Once per bar close, review the symbol and interval, and set the notification channel. Check Alerts Log after a new confirmed flip.
//@version=6
indicator("HA body direction at close", overlay = true)
haTicker = ticker.heikinashi(syminfo.tickerid)
[haOpen, haClose] = request.security(haTicker, timeframe.period, [open, close], gaps = barmerge.gaps_on)
int direction = na(haOpen) or na(haClose) ? 0 : haClose > haOpen ? 1 : haClose < haOpen ? -1 : 0
var int lastNonFlat = 0
upFlip = barstate.isconfirmed and direction == 1 and lastNonFlat == -1
downFlip = barstate.isconfirmed and direction == -1 and lastNonFlat == 1
if barstate.isconfirmed and direction != 0
lastNonFlat := direction
plotshape(upFlip, title = "Up flip", style = shape.triangleup, location = location.belowbar, color = color.teal, size = size.tiny)
plotshape(downFlip, title = "Down flip", style = shape.triangledown, location = location.abovebar, color = color.orange, size = size.tiny)
alertcondition(upFlip, "HA turned up", "{{ticker}} {{interval}}: Heikin Ashi turned up at bar close")
alertcondition(downFlip, "HA turned down", "{{ticker}} {{interval}}: Heikin Ashi turned down at bar close")