A long triggers when Williams %R(14) crosses above -80, and a short when it crosses below -20. Longs close once %R is above -50 and shorts once it is below -50. A 1% stop protects each trade.
Best run of 16. Nasdaq 100, 30 min, spread 3, from run sweeps:2026-09-07-NAS100-30m-opt.tsv:20.
| 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 |
| williamsPeriod Williams %R length | 14 |
| oversoldLevel Buy when %R climbs back above this | -80 |
| overboughtLevel Sell short when %R drops back below this | -20 |
| williamsExitLevel Close the trade when %R passes the midpoint | -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 | 15,667 | 50.90 | -49,262 EUR | -52,557 |
| S&P 500 | 1 hour | n/a | 10,263 | 56.35 | -7,052 EUR | -8,015 |
| Gold | 1 hour | n/a | 9,699 | 57.39 | -9,119 EUR | -9,156 |
| Gold | 15 min | n/a | 14,468 | 54.14 | -9,529 EUR | -9,665 |
| Gold | 5 min | n/a | 14,142 | 54.80 | -9,878 EUR | -9,935 |
| Gold | 30 min | n/a | 14,830 | 56.59 | -10,448 EUR | -10,499 |
| S&P 500 | 5 min | n/a | 14,243 | 50.78 | -13,127 EUR | -13,148 |
| S&P 500 | 30 min | n/a | 15,196 | 53.33 | -14,271 EUR | -14,775 |
| S&P 500 | 15 min | n/a | 14,583 | 55.94 | -15,426 EUR | -15,445 |
| Nasdaq 100 | 1 hour | n/a | 10,801 | 52.13 | -28,487 EUR | -29,626 |
| DAX 40 | 1 hour | n/a | 9,341 | 59.93 | -36,842 EUR | -37,955 |
| DAX 40 | 15 min | n/a | 14,650 | 60.25 | -42,611 EUR | -44,380 |
| Nasdaq 100 | 5 min | n/a | 14,125 | 58.06 | -46,027 EUR | -46,375 |
| DAX 40 | 5 min | n/a | 14,319 | 56.23 | -47,307 EUR | -47,598 |
| Nasdaq 100 | 15 min | n/a | 14,795 | 59.13 | -50,134 EUR | -52,157 |
| DAX 40 | 30 min | n/a | 15,097 | 59.31 | -59,845 EUR | -63,442 |
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.
// ============================================================ // Williams %R 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 williamsPeriod = 14 // Williams %R length oversoldLevel = -80 // buy when %R climbs back above this overboughtLevel = -20 // sell short when %R drops back below this williamsExitLevel = -50 // close the trade when %R passes the midpoint stopLossPct = 1 // protective stop, percent of entry price // --- Indicators --- williamsValue = Williams[williamsPeriod](close)
26 more lines: the entry and exit rules.
Read this first
Questions
It can run in ProOrder, but every backtest lost money. It is shown here as a result, not a recommendation.
Nasdaq 100, S&P 500, Gold and DAX 40. The smallest loss was S&P 500 1 hour at EUR -7,051.78, and DAX 40 30 minutes lost EUR -59,845.2.
The Nasdaq 100 run had a EUR 52,556.9 drawdown with 1 contract.
No. Every run from 5 minutes to 1 hour lost money.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.