Join waitlist
Strategies / Trend / Heikin Ashi Color Flip

Heikin Ashi Color Flip

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.

TrendLong onlySwingDAX 404 hours
1.12Profit factor
14,847Net profit EUR
38.11%Win rate
3,692Trades
-3,423Max drawdown
4.02Avg trade

Best run of 5. DAX 40, 4 hours, spread 3, from run pf:2026-10-10-DAX40-4h.tsv:2.

Entry rules, long

  1. The Heikin Ashi candle is green, with its close above its open.
  2. The previous Heikin Ashi candle was red.
  3. Signals are checked only after bar 2 and only when no long position is open.

Exit rules

  1. The Heikin Ashi candle is red and the previous candle was green, which closes the long at market.

Test conditions

PeriodUp to 2026-10-10
InstrumentDAX 40, 4 hours
Spread3 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run4 hours1.12 3,69238.1114,847 EUR-3,423
USD/JPY4 hoursn/a 4,31136.00362,080 USD-287,030
Dow JonesDailyn/a 1,72938.4013,747 EUR-8,921
Nasdaq 1004 hoursn/a 3,77935.2211,300 EUR-4,855
Gold4 hoursn/a 3,83233.431,296 EUR-1,039

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// 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

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

Heikin Ashi
Read this firstKnown weaknesses2 points
  • A profit factor of 1.12 leaves little room for costs beyond the spread.
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.

Questions

About this strategy

Can I run Heikin Ashi Color Flip in ProOrder?

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.

Which markets was it tested on?

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.

How large was the drawdown?

The best run had a maximum drawdown of 3,423 EUR at the tested position size, against a net result of 14,847 EUR.

Does it trade long, short or both?

It only takes long trades.

Related

Strategies like this one

Color Code Candle Flip

Uses the same indicator.

1.56 PF · 3,285 trades

Donchian Channel Breakout

Best run on the same market, DAX 40.

1.04 PF · 3,444 trades

EMA Crossover 1% Stop 2% Target

Also a trend strategy.

1.11 PF · 6,019 trades

Get the full rules, the complete code and the ProRealAlgos portfolio as a member.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs