Longs enter on a Stochastic %K(18,2) cross above its 6 period %D, while shorts need %K to fall back from above 90 and cross down twice. Exits wait for RSI(2) to touch an extreme several times before closing. No stop or target is used.
Best run of 14. Silver, 1 hour, spread 2, from run pf:2026-09-16-SILVER-1h.tsv:1.
| Period | Up to 2026-09-16 |
| Instrument | Silver, 1 hour |
| Spread | 2 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-16 |
| positionSize Contracts per trade | 1 |
| stochPeriod Stochastic lookback | 18 |
| stochSmooth %K smoothing | 2 |
| stochDPeriod %D average of %K | 6 |
| overboughtLevel Extreme high for a short setup | 90 |
| oversoldLevel Extreme low for a long setup | 10 |
| consolidationPeriod Bars checked for the extreme reading | 2 |
| rsiPeriod RSI length for exits | 2 |
| rsiUpperLevel RSI peak level for long exits | 95 |
| rsiLowerLevel RSI trough level for short exits | 5 |
| rsiExitCount RSI peaks needed before exit | 4 |
| rsiPeakLookback Bars used to measure each RSI peak | 8 |
| rsiBaseline Starting value for the last RSI peak | 50 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| SilverBest run | 1 hour | 3.94 | 974 | 56.98 | 571,597 USD | -568,775 |
| Nikkei 225 | 4 hours | 1.70 | 231 | 64.50 | 52,240 USD | -13,131 |
| S&P 500 | Daily | 1.65 | 135 | 59.26 | 3,714 EUR | -1,595 |
| Nasdaq 100 | 1 hour | 1.18 | 1,060 | 57.17 | 14,231 EUR | -6,458 |
| Dow Jones | 5 min | 1.16 | 1,608 | 58.64 | 18,565 EUR | -7,440 |
| Nikkei 225 | 15 min | 1.11 | 1,669 | 58.24 | 28,398 USD | -23,317 |
| Nikkei 225 | 30 min | 1.10 | 1,668 | 55.22 | 26,850 USD | -24,064 |
| Dow Jones | 10 min | 1.10 | 1,627 | 58.45 | 17,249 EUR | -9,746 |
| S&P 500 | 30 min | 1.10 | 1,541 | 58.34 | 2,486 EUR | -1,195 |
| Silver | 3 min | 1.09 | 1,562 | 56.59 | 20,029 USD | -16,252 |
| Dow Jones | 3 min | 1.08 | 1,588 | 58.56 | 8,452 EUR | -6,349 |
| DAX 40 | 1 hour | 1.07 | 977 | 57.52 | 6,429 EUR | -5,527 |
| Nikkei 225 | Daily | n/a | 95 | 65.26 | 42,661 USD | -19,731 |
| FTSE 100 | Daily | n/a | 99 | 58.59 | 4,665 EUR | -4,527 |
Charts
Above 1.0 made money, below 1.0 lost money.
Longer history
Silver 3 minutes had all 1,000,000 bars, and the long run lost USD 23,707 where the standard run made USD 20,029, meaning the older data alone lost USD 43,736.
| Bars available | 1,000,000 |
| Net, standard 200,000-bar run | 20,029.00 USD |
| Net, long run | -23,707.00 USD |
| Net on the older data alone | -43,736.00 USD |
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.
// ============================================================ // Stochastic Extreme Reversal // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: 1 hour // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false DEFPARAM PreloadBars = 1000 // --- Parameters --- positionSize = 1 // contracts per trade stochPeriod = 18 // stochastic lookback stochSmooth = 2 // %K smoothing stochDPeriod = 6 // %D average of %K overboughtLevel = 90 // stochastic must have been above this for a short setup oversoldLevel = 10 // stochastic must have been below this for a long setup consolidationPeriod = 2 // bars checked for the extreme reading rsiPeriod = 2 // fast RSI used for exits rsiUpperLevel = 95 // RSI peak level that counts for longs rsiLowerLevel = 5 // RSI trough level that counts for shorts rsiExitCount = 4 // RSI peaks needed before the exit is allowed rsiPeakLookback = 8 // bars used to measure each RSI peak rsiBaseline = 50 // starting value for the last RSI peak ONCE setupState = 0 // -1 long setup, 1 short setup, 0 none ONCE barsSinceSetup = 0 ONCE rsiPeakCount = 0 ONCE lowerPeakCount = 0 ONCE lastRsiPeak = 0 // --- Indicators --- stochK = Stochastic[stochPeriod, stochSmooth](close) stochD = Average[stochDPeriod](stochK) rsiValue = RSI[rsiPeriod](close)
56 more lines: the entry and exit rules.
Read this first
Questions
Yes, it uses Stochastic and RSI only, with one position at a time. Compile check the rewritten code first.
Silver, Nikkei 225, S&P 500, Nasdaq 100, Dow Jones, DAX 40 and FTSE 100. Every listed run was profitable, with DAX 40 1 hour the weakest at a profit factor of 1.07.
The best run hit USD 568,775 drawdown on Silver 1 hour. On S&P 500 Daily it was EUR 1,594.53, so size by instrument.
That run gave the highest profit factor on the page, 3.94. The RSI(2) exit needs several swings, which hourly bars provide in a few days.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.