Calculates raw stochastic %K over 30 bars. It buys when %K crosses above 80 and sells when it crosses back below 80.
Best run of 8. Gold, 4 hours, spread 0.6, from run pf:2026-10-12-GOLD-4h.tsv:9.
| Period | Up to 2026-10-12 |
| Instrument | Gold, 4 hours |
| Spread | 0.6 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| GoldBest run | 4 hours | 1.34 | 1,424 | 31.60 | 2,271 EUR | -554 |
| USD/JPY | Daily | 1.33 | 601 | 34.78 | 1,061,490 USD | -190,850 |
| Nikkei 225 | 4 hours | n/a | 1,256 | 31.69 | 20,452 USD | -5,909 |
| Nasdaq 100 | Daily | n/a | 633 | 33.49 | 8,778 EUR | -3,005 |
| DAX 40 | Daily | n/a | 799 | 34.29 | 7,418 EUR | -2,949 |
| DAX 40 | 4 hours | n/a | 1,473 | 32.45 | 6,736 EUR | -2,294 |
| Gold | Daily | n/a | 630 | 34.92 | 2,323 EUR | -755 |
| S&P 500 | Daily | n/a | 843 | 31.67 | 1,177 EUR | -721 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // Stochastic Eighty Level Crossover // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE myK = 50 hi = highest[30](high) lo = lowest[30](low)
16 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 8 market and timeframe combinations. The best run was Gold, 4 hours, with a profit factor of 1.34 over 1,424 trades.
The best run had a maximum drawdown of 554 EUR at the tested position size, against a net result of 2,271 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.