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.
Best run of 9. Gold, 30 min, spread 0.6, from run sweeps:2026-09-23-GOLD-30m-opt.tsv:2.
| Period | Up to 2026-09-23 |
| Instrument | Gold, 30 minutes |
| Spread | 0.6 points |
| Contracts | 1 |
| 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-09-24 |
| positionSize Contracts per trade | 1 |
| trendPeriod Trend filter average length | 130 |
| warmupBars Bars before the Heikin Ashi open starts | 2 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 30 min | n/a | 3,700 | 25.59 | 2,203 EUR | -2,042 |
| USD/JPY | Daily | 0.00 | 1 | 0.00 | -13,300 JPY | -13,300 |
| USD/JPY | 10 min | n/a | 3,472 | 22.52 | 371,440 JPY | -279,560 |
| EUR/USD | Daily | n/a | 212 | 25.94 | 159,308 USD | -58,520 |
| Nasdaq 100 | Daily | n/a | 175 | 25.71 | 11,794 EUR | -5,987 |
| Brent Crude | 30 min | n/a | 2,178 | 26.86 | 10,754 EUR | -5,190 |
| S&P 500 | Daily | n/a | 215 | 28.37 | 3,550 EUR | -1,051 |
| Gold | Daily | n/a | 227 | 26.43 | 2,625 EUR | -2,076 |
| Gold | 1 hour | n/a | 2,101 | 23.32 | 1,442 EUR | -877 |
Charts
The code
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
Questions
Yes. It is a stop and reverse system with no extra exit logic. Compile check the rewritten code first.
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.
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.
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
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.