After the 15 SMA crosses the 100 SMA, the system waits for price to close on the wrong side of the 15 SMA and then back through it. A close beyond the 100 SMA cancels the setup. Trades end at a 150 point stop or when an opposite entry reverses them.
Best run of 17. Gold, 2 min, spread 0.6, from run sweeps:2026-09-20-GOLD-2m-opt.tsv:3.
| Period | Up to 2026-09-20 |
| Instrument | Gold, 2 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-21 |
| positionSize Contracts per trade | 1 |
| fastPeriod Fast SMA length | 15 |
| slowPeriod Slow SMA length | 100 |
| stopLossPoints Protective stop in points | 150 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 2 min | n/a | 1,105 | 36.74 | 1,624 EUR | -820 |
| USD/JPY | Daily | n/a | 80 | 13.75 | 909,310 JPY | -748,100 |
| USD/JPY | 10 min | n/a | 1,088 | 37.68 | 626,730 JPY | -240,590 |
| USD/JPY | 4 hours | n/a | 189 | 30.69 | 608,410 JPY | -346,200 |
| USD/JPY | 5 min | n/a | 999 | 36.94 | 478,280 JPY | -159,550 |
| USD/JPY | 15 min | n/a | 1,056 | 37.59 | 469,080 JPY | -351,910 |
| EUR/USD | Daily | n/a | 73 | 20.55 | 151,656 USD | -32,530 |
| Silver | 3 min | n/a | 1,097 | 36.46 | 43,616 USD | -11,318 |
| Silver | 2 min | n/a | 1,086 | 35.54 | 26,842 USD | -20,073 |
| GBP/USD | Daily | n/a | 106 | 18.87 | 10,953 USD | -5,481 |
| Nasdaq 100 | Daily | n/a | 69 | 21.74 | 8,969 EUR | -3,126 |
| Brent Crude | 3 min | n/a | 1,070 | 36.54 | 6,737 EUR | -2,641 |
| US Crude Oil | 3 min | n/a | 1,072 | 36.75 | 6,372 EUR | -4,128 |
| US Crude Oil | 4 hours | n/a | 148 | 23.65 | 6,249 EUR | -4,949 |
| Brent Crude | Daily | n/a | 44 | 9.09 | 5,036 EUR | -3,777 |
| S&P 500 | Daily | n/a | 74 | 40.54 | 3,769 EUR | -1,018 |
| Gold | 15 min | n/a | 1,059 | 36.54 | 2,680 EUR | -1,000 |
Charts
Top 10 of 17 runs. The full list is in the table above.
The code
// ============================================================ // MA Cross Pullback // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 2 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade fastPeriod = 15 // fast SMA slowPeriod = 100 // slow SMA stopLossPoints = 150 // protective stop in points // Setup flags, carried from bar to bar. ONCE longCrossSeen = 0 ONCE longPullbackSeen = 0 ONCE shortCrossSeen = 0 ONCE shortPullbackSeen = 0 // --- Indicators --- fastMA = Average[fastPeriod](close) slowMA = Average[slowPeriod](close)
49 more lines: the entry and exit rules.
Setup
Questions
Yes, it only uses moving averages and a fixed stop. The rewritten code is not compile-checked, so run it on demo first.
Gold 2 minutes made EUR 1,623.9 and Gold 15 minutes EUR 2,680.0. S&P 500 Daily made EUR 3,768.77 on 74 trades.
On Gold 2 minutes the max drawdown was EUR 820.1 with 1 contract, and on Gold 15 minutes EUR 999.8.
The pullback pattern forms often on 2 minute Gold bars, giving 1,105 trades. The thin EUR 1.47 average trade means costs matter a lot there.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.