The strategy buys when a Heikin Ashi candle turns green after a red one. It sells when a Heikin Ashi candle turns red after a green one, and it does not sell short.
Best run of 5. DAX 40, 4 hours, spread 3, from run pf:2026-10-10-DAX40-4h.tsv:2.
| Period | Up to 2026-10-10 |
| Instrument | DAX 40, 4 hours |
| Spread | 3 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-10-10 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | 1.12 | 3,692 | 38.11 | 14,847 EUR | -3,423 |
| USD/JPY | 4 hours | n/a | 4,311 | 36.00 | 362,080 USD | -287,030 |
| Dow Jones | Daily | n/a | 1,729 | 38.40 | 13,747 EUR | -8,921 |
| Nasdaq 100 | 4 hours | n/a | 3,779 | 35.22 | 11,300 EUR | -4,855 |
| Gold | 4 hours | n/a | 3,832 | 33.43 | 1,296 EUR | -1,039 |
Charts
The code
// ============================================================== // Heikin Ashi Color Flip // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE haopen = 0 ONCE haclose = 0 ONCE green = 0 ONCE red = 0 prevhaopen = haopen prevhaclose = haclose prevgreen = green prevred = red haclose = (open + high + low + close) / 4 IF BarIndex = 0 THEN haopen = (open + close) / 2 ELSE haopen = (prevhaopen + prevhaclose) / 2 ENDIF
12 more lines: the entry and exit rules.
Setup
Questions
Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.
It was tested on 5 market and timeframe combinations. The best run was DAX 40, 4 hours, with a profit factor of 1.12 over 3,692 trades.
The best run had a maximum drawdown of 3,423 EUR at the tested position size, against a net result of 14,847 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.