Buys when a short moving average crosses above a long moving average, with the pair chosen by the 20-period EMA slope and close position. Closes the long when the short average crosses back below the long average.
Best run of 14. Nasdaq 100, 4 hours, spread 3, from run pf:2026-10-13-NAS100-4h.tsv:2.
| Period | Up to 2026-10-13 |
| Instrument | Nasdaq 100, 4 hours |
| Spread | 3 points |
| 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-10-13 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| Nasdaq 100Best run | 4 hours | 1.42 | 1,614 | 49.81 | 25,029 EUR | -5,239 |
| USD/JPY | 4 hours | n/a | 1,964 | 51.12 | 666,110 USD | -331,130 |
| Nikkei 225 | Daily | n/a | 646 | 50.93 | 37,009 USD | -30,326 |
| Nikkei 225 | 4 hours | n/a | 1,407 | 47.76 | 33,944 USD | -14,965 |
| Dow Jones | Daily | n/a | 852 | 51.53 | 30,889 EUR | -8,985 |
| Silver | 4 hours | n/a | 1,598 | 50.44 | 26,698 USD | -15,432 |
| Nasdaq 100 | Daily | n/a | 624 | 45.51 | 15,324 EUR | -5,607 |
| Dow Jones | 1 hour | n/a | 2,157 | 50.86 | 14,648 EUR | -8,506 |
| Dow Jones | 4 hours | n/a | 555 | 48.47 | 13,134 EUR | -8,943 |
| DAX 40 | 4 hours | n/a | 1,600 | 50.62 | 12,231 EUR | -7,244 |
| DAX 40 | Daily | n/a | 797 | 46.05 | 8,054 EUR | -7,644 |
| S&P 500 | 4 hours | n/a | 1,674 | 50.00 | 3,602 EUR | -1,290 |
| S&P 500 | Daily | n/a | 810 | 45.56 | 3,288 EUR | -1,239 |
| Gold | Daily | n/a | 761 | 49.01 | 2,592 EUR | -1,778 |
Charts
Top 10 of 14 runs. The full list is in the table above.
The code
// ============================================================== // Regime Switched Moving Average Crossover // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false base = ExponentialAverage[20](close) slope = base - base[1] hraw = 2 * WeightedAverage[12](close) - WeightedAverage[24](close) hmaa = WeightedAverage[4](hraw) hrawb = 2 * WeightedAverage[29](close) - WeightedAverage[59](close) hmab = WeightedAverage[7](hrawb) emaf = ExponentialAverage[15](close) smaf = Average[19](close) rmas = WilderAverage[45](close) rmaf = WilderAverage[16](close) rmag = WilderAverage[12](close) rmah = WilderAverage[36](close)
28 more lines: the entry and exit rules.
Setup
Questions
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.
It was tested on 14 market and timeframe combinations. The best run was Nasdaq 100, 4 hours, with a profit factor of 1.42 over 1,614 trades.
The best run had a maximum drawdown of 5,239 EUR at the tested position size, against a net result of 25,028 EUR.
It only takes long trades.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.