Join today
Strategies / Trend / Heikin Ashi Trend Cross

Heikin Ashi Trend Cross: colour flips with a 130 SMA filter

A long opens when the Heikin Ashi candle flips from bearish to bullish while price is above the 130 period SMA. A short opens on the reverse flip below the average. There is no stop or target, so the strategy is always reversing on the next opposite signal.

TrendLong & shortIntradayGold30 min
n/aProfit factor
2,203Net profit EUR
25.59%Win rate
3,700Trades
-2,042Max drawdown
0.60Avg trade

Best run of 9. Gold, 30 min, spread 0.6, from run sweeps:2026-09-23-GOLD-30m-opt.tsv:2.

Entry rules, long

  1. Members only
  2. Close is above the 130-period SMA
  3. No long is open

Entry rules, short

  1. Members only
  2. Close is below the 130-period SMA
  3. No short is open

Exit rules

  1. Members only
  2. No stop loss or target

Test conditions

PeriodUp to 2026-09-23
InstrumentGold, 30 minutes
Spread0.6 points
Contracts1
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-09-24

Parameters

positionSize
Contracts per trade
1
trendPeriod
Trend filter average length
130
warmupBars
Bars before the Heikin Ashi open starts
2

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run30 minn/a 3,70025.592,203 EUR-2,042
USD/JPYDaily0.00 10.00-13,300 JPY-13,300
USD/JPY10 minn/a 3,47222.52371,440 JPY-279,560
EUR/USDDailyn/a 21225.94159,308 USD-58,520
Nasdaq 100Dailyn/a 17525.7111,794 EUR-5,987
Brent Crude30 minn/a 2,17826.8610,754 EUR-5,190
S&P 500Dailyn/a 21528.373,550 EUR-1,051
GoldDailyn/a 22726.432,625 EUR-2,076
Gold1 hourn/a 2,10123.321,442 EUR-877

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-500K-250K250K500KUSD/JPY · 10 minEUR/USD · DailyNasdaq 100 · DailyBrent Crude · 30 minS&P 500 · DailyGold · DailyGold · 30 minGold · 1 hourUSD/JPY · Daily

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Heikin Ashi Trend Cross
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 30 minutes
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
positionSize = 1       // contracts per trade
trendPeriod = 130      // trend filter average length
warmupBars = 2         // Heikin Ashi open starts after this many bars

// --- Indicators ---
haClose = (open + high + low + close) / 4
IF BarIndex > warmupBars THEN
  haOpen = (haOpen[1] + haClose[1]) / 2
ENDIF

trendMA = Average[trendPeriod](close)
haTurnUp = haClose > haOpen AND haClose[1] < haOpen[1]
haTurnDown = haClose < haOpen AND haClose[1] > haOpen[1]

15 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • No stop loss or target is used. Losses are only capped when an opposite signal appears.
  • Win rate on the best run was 25.59%, and every listed run was below 30%.
  • On Gold 30 minutes the EUR 2,202.8 profit came with a EUR 2,041.5 drawdown and an average trade of EUR 0.6, very thin after costs.
  • USD/JPY Daily took just 1 trade and lost JPY 13,300. Only sweep data exists elsewhere, so profit factor was not recorded.

Indicators used

Heikin AshiSMA

How to load it

  1. Copy the code with the copy button above 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.

Questions

About this strategy

Can it run as a ProOrder robot?

Yes. It is a stop and reverse system with no extra exit logic. Compile check the rewritten code first.

How did it do across markets?

7 of 8 runs were profitable, including USD/JPY 10 minutes (JPY 371,440) and EUR/USD Daily (USD 159,308). USD/JPY Daily was the loser.

How much capital does 1 contract need?

The best run had a max drawdown of EUR 2,041.5, but USD/JPY 10 minutes reached JPY 279,560. With no stop, plan for drawdowns larger than these.

Why 30 minute bars on Gold?

The 30 minute Gold run gave the best result with a large sample of 3,700 trades. Heikin Ashi smoothing helps cut some noise on intraday bars.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Triple Band Market Model

Best run on the same market, Gold.

2.27 PF · 203 trades

Long-Term Moving Average Cross

Also a trend strategy.

12.31 PF · 61 trades

Want more trend systems to test? Get on the ProRealAlgos waitlist.

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