A trade opens on the bar where the Parabolic SAR flips sides, but only if the smoothed Stochastic and the MACD histogram agree with the new direction. Longs exit when the close falls below the SAR. Shorts have no exit of their own and close only when a long signal reverses them.
Best run of 4. USD/JPY, 1 hour, spread 1, from run sweeps:2026-09-22-USDJPY-1h-opt.tsv:2.
| Period | Up to 2026-09-22 |
| Instrument | USD/JPY, 1 hour |
| 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-22 |
| positionSize Contracts per trade | 1 |
| sarStart Parabolic SAR starting acceleration | 0.02 |
| sarStep Acceleration step | 0.02 |
| sarMax Maximum acceleration | 0.2 |
| stochPeriod Stochastic lookback | 5 |
| stochSmooth %K smoothing | 3 |
| stochDSmooth SMA of %K used as the signal | 3 |
| stochMidLevel Longs need the signal above this, shorts at or below | 50 |
| macdFast MACD fast length | 12 |
| macdSlow MACD slow length | 26 |
| macdSignalPeriod MACD signal length | 9 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBest run | 1 hour | n/a | 3,536 | 42.14 | 595,870 JPY | -349,410 |
| USD/JPY | Daily | n/a | 353 | 44.76 | 1,767,160 JPY | -504,600 |
| Silver | Daily | n/a | 350 | 45.43 | 31,566 USD | -8,085 |
| DAX 40 | 1 hour | n/a | 2,812 | 41.43 | 8,628 EUR | -5,071 |
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.
// ============================================================ // Parabolic SAR Flip // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: 1 hour // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade sarStart = 0.02 // Parabolic SAR starting acceleration sarStep = 0.02 // acceleration step sarMax = 0.2 // maximum acceleration stochPeriod = 5 // stochastic lookback stochSmooth = 3 // %K smoothing stochDSmooth = 3 // SMA of %K used as the signal stochMidLevel = 50 // longs need the signal above this, shorts need it at or below macdFast = 12 // MACD fast length macdSlow = 26 // MACD slow length macdSignalPeriod = 9 // MACD signal length // --- Indicators --- sarValue = SAR[sarStart, sarStep, sarMax] stochK = Stochastic[stochPeriod, stochSmooth](close) stochD = Average[stochDSmooth](stochK) macdHistogram = MACD[macdFast, macdSlow, macdSignalPeriod](close)
23 more lines: the entry and exit rules.
Read this first
Questions
Yes, it is written for automated trading at 1 contract per trade. Be aware that shorts rely on a reversal to close.
USD/JPY 1 hour made JPY 595,870.00 over 3,536 trades. USD/JPY daily, Silver daily and DAX 40 1 hour were also profitable, with DAX 40 making EUR 8,628.00 over 2,812 trades.
The headline run had a max drawdown of JPY 349,410.00. On DAX 40 1 hour it was EUR 5,070.90. Size capital to the instrument you trade.
SAR flips on hourly bars give plenty of signals for the Stochastic and MACD filters to screen. Daily bars trade far less, at 353 trades on USD/JPY.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.