Three simple moving averages of 50, 99 and 297 bars set the direction. When they line up in rising order the system goes long, and in falling order it goes short. It stays in the trade while the averages are mixed and only flips on the opposite alignment.
Best run of 21. Gold, 5 min, spread 0.6, from run pf:2026-09-24-GOLD-5m.tsv:2.
| Period | Up to 2026-09-24 |
| Instrument | Gold, 5 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 |
| fastPeriod Fast simple moving average | 50 |
| midPeriod Middle simple moving average | 99 |
| slowPeriod Slow simple moving average | 297 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 5 min | 1.43 | 689 | 37.59 | 3,616 EUR | -640 |
| USD/JPY | Daily | n/a | 43 | 46.51 | 1,829,610 JPY | -551,800 |
| USD/JPY | 1 hour | n/a | 489 | 35.17 | 420,600 JPY | -389,150 |
| USD/JPY | 5 min | n/a | 697 | 38.02 | 409,720 JPY | -164,650 |
| USD/JPY | 2 min | n/a | 694 | 34.44 | 177,140 JPY | -94,930 |
| EUR/USD | Daily | n/a | 37 | 40.54 | 112,364 USD | -50,301 |
| Dow Jones | Daily | n/a | 36 | 50.00 | 26,091 EUR | -13,759 |
| Silver | 5 min | n/a | 709 | 35.54 | 25,631 USD | -24,086 |
| Nasdaq 100 | Daily | n/a | 28 | 46.43 | 21,362 EUR | -5,520 |
| Dow Jones | 3 min | n/a | 700 | 38.14 | 14,247 EUR | -7,026 |
| GBP/USD | Daily | n/a | 49 | 42.86 | 12,343 USD | -9,278 |
| US Crude Oil | 4 hours | n/a | 82 | 37.80 | 8,985 EUR | -5,330 |
| Brent Crude | 4 hours | n/a | 54 | 38.89 | 8,828 EUR | -8,258 |
| S&P 500 | Daily | n/a | 32 | 56.25 | 4,280 EUR | -1,615 |
| Gold | Daily | n/a | 36 | 47.22 | 3,866 EUR | -1,685 |
| Gold | 3 min | n/a | 685 | 34.45 | 2,871 EUR | -803 |
| Gold | 10 min | n/a | 705 | 36.03 | 2,165 EUR | -1,049 |
| Gold | 4 hours | n/a | 101 | 38.61 | 2,105 EUR | -1,588 |
| Gold | 30 min | n/a | 684 | 36.84 | 1,971 EUR | -1,355 |
| Gold | 1 hour | n/a | 433 | 35.33 | 1,514 EUR | -1,059 |
| Gold | 2 min | n/a | 704 | 36.51 | 967 EUR | -784 |
Charts
Longer history
With 1,000,000 bars on Gold 5 minutes the profit was EUR 3,377.30 versus EUR 3,615.90 in the standard run, so the older data alone gave back EUR 238.60.
| Bars available | 1,000,000 |
| Net, standard 200,000-bar run | 3,615.90 EUR |
| Net, long run | 3,377.30 EUR |
| Net on the older data alone | -238.60 EUR |
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.
// ============================================================ // Three MA Trend // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 5 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade fastPeriod = 50 // fast simple moving average midPeriod = 99 // middle simple moving average slowPeriod = 297 // slow simple moving average // --- Indicators --- fastMA = Average[fastPeriod](close) midMA = Average[midPeriod](close) slowMA = Average[slowPeriod](close)
15 more lines: the entry and exit rules.
Read this first
Questions
Yes. It needs only three averages and trades 1 contract per signal.
Gold 5 minutes gave profit factor 1.43 and EUR 3,615.90 over 689 trades. All twenty runs across forex, indices, metals and oil ended positive.
At 1 contract on Gold 5 minutes, max drawdown was EUR 640.20.
Long averages on short bars catch intraday trends while still trading often enough, at 689 trades on Gold.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.