Ready to go further
Next: test the rule on real fills
The backtesting guide covers the steps and the traps, including a test that fills at prices that never traded.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- Heikin Ashi candles are built from ordinary candles by averaging. Each new candle uses the open and close of the one before, so the chart shows fewer colour changes.
- In the 12 made-up bars below, real candles change colour 10 times and Heikin Ashi candles 1 times (calculated by us on 28 Oct 2026, exact).
- The prices on a Heikin Ashi candle are not traded prices. A Heikin Ashi open or close is an average and may sit where the market never traded.
- The smoothing delays the signal. A Heikin Ashi candle changes colour after the real price has already turned.
- A bot that reads Heikin Ashi can use it to decide, but must place and price its orders from real prices.
The formula
For each bar you start with the real open, high, low and close. The Heikin Ashi candle is then built so that it leans on the candle before it:
HA open = (previous HA open + previous HA close) / 2
HA high = highest of the real high, HA open and HA close
HA low = lowest of the real low, HA open and HA close
The first bar has no earlier candle, so the HA open is usually set to the average of its real open and close. Heikin Ashi is Japanese for "average bar".
A worked example
Take bar 4 of the made-up path: open 101.1, high 102.6, low 101, close 102.4. The HA close is (101.1 + 102.6 + 101 + 102.4) / 4 = 101.78. The HA open is the average of the previous HA open 100.78 and previous HA close 101.45, which is 101.12. The HA high is the highest of 102.6, 101.12 and 101.78, which is 102.60. The HA low is the lowest of 101, 101.12 and 101.78, which is 101.00. All prices here are made up.
Notice that bar 3 closed lower than it opened, a down candle in real terms. In Heikin Ashi it is still an up candle, because its average close sits above its smoothed open. That is the smoothing at work.
| Bar | Real direction | HA direction |
|---|---|---|
| 1 | up | down |
| 2 | up | up |
| 3 | down | up |
| 4 | up | up |
| 5 | down | up |
| 6 | up | up |
| 7 | down | up |
| 8 | up | up |
| 9 | down | up |
| 10 | up | up |
| 11 | down | up |
| 12 | up | up |
Down candles show up 5 times in the real path and 1 time in the Heikin Ashi path, in a market that mostly went up. That is why the chart looks cleaner. The only Heikin Ashi down candle is the first bar, which has no earlier candle to lean on. A rule that exits on a colour change would have stayed in this whole path, but it would also have stayed in a path that had really turned, for the same reason.
What the smoothing costs
- Delay. Each Heikin Ashi bar leans on the one before, so it needs a real move that outweighs the old average before it changes colour. In a turn the signal arrives after a larger part of the move has gone.
- Not real prices. A signal can say a candle closed at 101.78 when the market closed at 102.4. Orders, stops and the stop loss must be set from real prices, or the trade is measured against a level that never existed.
- It hides gaps. A real gap between bars can be smoothed away, and a stop placed on the smoothed chart may be inside a real gap.
How a bot misuses it
A common rule is to hold while the candles are one colour and leave when the colour changes. In a clean trend that keeps you in. In a range it flips often, and each flip pays the spread and sometimes slippage. A backtest on Heikin Ashi prices can also fill trades at prices that did not trade, which makes the result look better than it was. That is the same trap as the perfect fills in a backtest, and it is easy to do by accident when a platform draws the chart one way and the test runs on the other.
How to check a rule that uses it
Make sure every fill in the test uses real prices, even if the signal comes from Heikin Ashi. Test it in a trend and in a range, count the trades and use full costs. Keep data back and test once, to guard against overfitting. Look at the max drawdown as well as the total.
What this page does not tell you
It does not say that Heikin Ashi improves results. It shows the arithmetic and the costs of the smoothing. The prices are made up and it is education, not a signal.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What are Heikin Ashi candles?
Candles built from the average of each bar and the one before it, so the chart shows fewer colour changes in a trend. The name means average bar in Japanese.
How are Heikin Ashi candles calculated?
HA close is the average of open, high, low and close. HA open is the average of the previous HA open and close. HA high and low are the extremes of the real high or low and the HA open and close.
Can a bot trade on Heikin Ashi prices?
It can use them for signals, but orders, stops and fills must use real prices. A Heikin Ashi open or close may be a level that never traded.
Why do Heikin Ashi candles lag?
Each candle leans on the one before, so it takes a larger real move to turn it. The signal arrives after part of the move has gone.
Does Heikin Ashi make a strategy more profitable?
Not by itself. It makes a trend easier to read, but it adds delay and can hide gaps. Test any rule on real fills with full costs.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is general education about a calculation. The prices are made up and it is not a signal.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss