Longs trigger when Stochastic %K (14,3) crosses above %D below 20, and shorts when it crosses below %D above 80. Positions close when %K reaches 50 or at a 1% stop. There is no profit target and only one position at a time.
Best run of 16. Nasdaq 100, 30 min, spread 3, from run sweeps:2026-09-07-NAS100-30m-opt.tsv:12.
| Period | Up to 2026-09-07 |
| Instrument | Nasdaq 100, 30 minutes |
| Spread | 3 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-07 |
| positionSize Contracts per trade | 1 |
| stochPeriod Stochastic lookback | 14 |
| stochSmooth %K smoothing | 3 |
| stochDSmooth %D smoothing | 3 |
| oversoldLevel Longs only when %K is below this | 20 |
| overboughtLevel Shorts only when %K is above this | 80 |
| stochExitLevel Exit once %K reaches this level | 50 |
| stopLossPct Protective stop, percent of entry price | 1 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| Nasdaq 100Best run | 30 min | n/a | 7,963 | 52.04 | -30,058 EUR | -32,678 |
| S&P 500 | 1 hour | n/a | 5,022 | 56.37 | -3,838 EUR | -5,052 |
| Gold | 5 min | n/a | 7,192 | 56.58 | -4,692 EUR | -4,776 |
| Gold | 30 min | n/a | 7,118 | 57.15 | -5,427 EUR | -5,828 |
| Gold | 15 min | n/a | 7,086 | 55.09 | -5,453 EUR | -5,516 |
| Gold | 1 hour | n/a | 4,813 | 57.24 | -5,458 EUR | -5,514 |
| S&P 500 | 5 min | n/a | 7,196 | 52.95 | -8,110 EUR | -8,192 |
| S&P 500 | 30 min | n/a | 7,707 | 53.95 | -8,194 EUR | -8,681 |
| S&P 500 | 15 min | n/a | 7,456 | 56.88 | -8,320 EUR | -8,593 |
| Nasdaq 100 | 1 hour | n/a | 5,199 | 53.16 | -17,295 EUR | -20,420 |
| DAX 40 | 5 min | n/a | 7,340 | 57.98 | -21,313 EUR | -21,799 |
| DAX 40 | 15 min | n/a | 7,411 | 59.67 | -22,602 EUR | -24,371 |
| Nasdaq 100 | 5 min | n/a | 7,322 | 57.74 | -24,857 EUR | -26,716 |
| DAX 40 | 1 hour | n/a | 4,873 | 55.92 | -28,474 EUR | -29,471 |
| DAX 40 | 30 min | n/a | 7,624 | 57.88 | -28,719 EUR | -32,246 |
| Nasdaq 100 | 15 min | n/a | 7,589 | 57.29 | -31,697 EUR | -33,705 |
Charts
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 Reversal // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade stochPeriod = 14 // stochastic lookback stochSmooth = 3 // %K smoothing stochDSmooth = 3 // %D smoothing oversoldLevel = 20 // longs only when %K is below this overboughtLevel = 80 // shorts only when %K is above this stochExitLevel = 50 // exit once %K reaches the middle stopLossPct = 1 // protective stop, percent of entry price // --- Indicators --- stochK = Stochastic[stochPeriod, stochSmooth](close) stochD = StochasticD[stochPeriod, stochSmooth, stochDSmooth](close)
26 more lines: the entry and exit rules.
Read this first
Questions
It can technically run in ProOrder, but every backtest lost money. Treat it as a reference for what does not work, not a live system.
Nasdaq 100, S&P 500, Gold and DAX 40. The smallest loss was S&P 500 1 hour at EUR -3,837.55, and Nasdaq 100 15 minutes lost EUR -31,697.2.
The Nasdaq 100 30 minute run had a EUR 32,677.8 drawdown with 1 contract.
Runs from 5 minutes to 1 hour all lost money, so the timeframe was not the problem.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.