The oscillator is a 5-day average of (close - open) / (high - low). When it drops below -0.2 while the 5-day SMA is above the 50-day SMA, the system buys, and the mirror setup sells short. Trades use a 50 point target and a 40 point stop, and an opposite signal reverses.
Best run of 6. S&P 500, Daily, spread 1, from run pf:2026-09-24-USA500-D.tsv:10.
| Period | Up to 2026-09-25 |
| Instrument | S&P 500, Daily |
| Spread | 1 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-25 |
| positionSize Size per point | 1 |
| fastPeriod Fast SMA length | 5 |
| slowPeriod Slow SMA length | 50 |
| bodyRatioPeriod Days averaged for the body ratio | 5 |
| bodyRatioLevel Average body ratio must be beyond plus or minus this | 0.2 |
| takeProfitPoints Profit target in points | 50 |
| stopLossPoints Protective stop in points | 40 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| S&P 500Best run | Daily | 1.18 | 627 | 46.73 | 1,818 EUR | -382 |
| USD/JPY | Daily | n/a | 1,519 | 48.12 | 493,600 JPY | -142,000 |
| EUR/USD | Daily | n/a | 1,442 | 47.09 | 34,097 USD | -16,473 |
| Dow Jones | Daily | n/a | 1,407 | 46.62 | 2,608 EUR | -1,360 |
| Gold | 4 hours | n/a | 966 | 43.58 | 927 EUR | -924 |
| Gold | Daily | n/a | 478 | 46.03 | 888 EUR | -414 |
Charts
The code
// ============================================================ // Oscillator Mean Reversion // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // size per point fastPeriod = 5 // fast SMA length slowPeriod = 50 // slow SMA length bodyRatioPeriod = 5 // days averaged for the body ratio bodyRatioLevel = 0.2 // average body ratio must be beyond plus or minus this takeProfitPoints = 50 // profit target, points stopLossPoints = 40 // protective stop, points // --- Indicators --- maOscillator = Average[fastPeriod](close) - Average[slowPeriod](close) // Day body as a share of the day range: +1 closes at the high from the low, -1 the reverse. dayBodyRatio = (DClose(0) - DOpen(0)) / ABS(DHigh(0) - DLow(0)) avgBodyRatio = Summation[bodyRatioPeriod](dayBodyRatio) / bodyRatioPeriod
16 more lines: the entry and exit rules.
Setup
Questions
Yes, it is fully automated and sized per point. The code was rewritten after testing and not compile-checked, so test it in ProBacktest first.
S&P 500 gave the best recorded run. USD/JPY daily made JPY 493,600 in a sweep with a JPY 142,000 drawdown, and EUR/USD, Dow Jones and Gold were also positive.
The S&P 500 daily best run had a max drawdown of EUR 381.56 at position size 1.
The trend and oscillator filters are built from daily averages, and the daily chart produced every listed result except Gold 4 hours.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.