TradeReign
Back to HomeEducation HubCompatibilityAboutDisclosures
TradingView Setup

How to Set a TradingView Heikin Ashi Alert Alert on a Candle Color Change

A color-change alert compares the direction of two Heikin Ashi candle bodies. That is a different condition from a Heikin Ashi close crossing a price level. In this guide, up means the Heikin Ashi close is above its own open, and down means it is below.

Quick Answer

Keep your chart on regular Candles. Add an indicator that reads the Heikin Ashi open and close for that symbol and interval. In Create alert, choose the indicator’s HA turned up or HA turned down condition and set the trigger to Once per bar close.

Start 7-Day TrialSet up the color-change alertCompare the two candle types

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.

  1. Open a standard Candles chart for your intended dated futures contract and choose the interval and session you want the alert to use.
  2. 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.
  3. 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.
  4. 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")

Which MES candle triggers the alert?

At A, 11:05 ET, the standard candle opens at 6,000.25 and closes at 6,000.50, so its body turns green. The Heikin Ashi candle has a synthetic open of 6,000.625 and a close of 6,000.375, shown to three decimal places. It still finishes down.

At B, 11:10 ET, the Heikin Ashi open is 6,000.500, the midpoint of the preceding Heikin Ashi body. The average of the current standard open, high, low, and close is 6,001.000. The Heikin Ashi candle finishes up for the first time after the decline. An active up alert qualifies at B’s close. The standard close at B is 6,001.50. Check the standard chart or your broker for prices and executions.

Same five-minute MES bars, different color change

Synthetic Regular candles and Heikin Ashi from the same prices 5-minute candles. Times are bar closes in ET.

Regular candles

Heikin Ashi from the same prices

At A, regular MES turns green while Heikin Ashi remains red. At B, the Heikin Ashi candle closes above its own open and the alert condition is true.

Check a flat candle, a missing alert, or a roll

If a Heikin Ashi bar closes exactly at its open, the script leaves the last up or down direction in place. After down, flat, up, the up alert qualifies on the third bar. After up, flat, up, there is no fresh alert. The first non-flat bar initializes the direction. A change in the forming candle can disappear before its close.

Markers on historical bars show where the condition was true. TradingView sends alerts on realtime bars after the alert is active. If you see a fresh marker without an Alerts Log entry, check the saved direction, interval, symbol, expiration and whether the alert was active at the close. If an entry appears in the log, check delivery separately.

TradingView stores a copy of the script and chart context for a running alert. After changing the script, interval, session, or dated futures contract, create and verify a replacement with the intended settings. Review the old alert in Alerts Manager so it does not keep sending signals for a contract you have rolled away from.

Sources

Official References

Platform details on this page were checked against these official resources.

TradingView Heikin Ashi chart settingsFormula and the option that colors bars by the previous close.TradingView Pine Script Heikin Ashi dataRequest a separate Heikin Ashi series.TradingView Pine Script alertsAlert conditions, realtime triggering and the chart settings captured at creation.TradingView Pine Script bar statesCheck the completed realtime candle in the main chart context.
Related Guides

Keep Building the Rule System

Compare two close alerts at the same price level

See when the standard price and the Heikin Ashi close cross a fixed threshold.

Set a TradingView moving average alert

Compare price crossing a moving average with a two-EMA crossover.

Compare Heikin Ashi strategy signals and fills

Check when the Strategy Tester uses standard prices for simulated fills.

FAQ

Common Questions

Can I keep normal candles and still receive Heikin Ashi alerts?

Yes. An indicator can request the Heikin Ashi series for the chart’s symbol and interval while your chart displays regular candles.

Why does a green regular candle sometimes give no Heikin Ashi alert?

The Heikin Ashi bar uses averaged prices and its own open. The up alert requires a completed Heikin Ashi up body after the last non-flat Heikin Ashi body was down.

Risk Disclosure

Futures trading contains substantial risk and is not suitable for every investor. TradeReign is a trading-discipline and rule-enforcement application. It does not provide trading advice, trade signals, investment recommendations, or performance guarantees.

TradeReign is not a broker-dealer, futures commission merchant, or investment advisor.

Futures trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Only risk capital - money that can be lost without jeopardizing financial security or lifestyle - should be used for trading. Past performance is not necessarily indicative of future results.