ADX(14) decides the mode. In quiet markets the system buys after a large down candle and shorts after a large up candle, and when ADX is high it follows the candle instead. Longs close 30 bars after the last trade and shorts after 5 bars.
Best run of 4. FTSE 100, 4 hours, spread 2, from run pf:2026-09-24-FTSE100-4h.tsv:2.
| Period | Up to 2026-09-25 |
| Instrument | FTSE 100, 4 hours |
| 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-25 |
| positionSize Contracts per trade | 1 |
| atrPeriod ATR length for candle size and volatility cap | 14 |
| adxPeriod ADX length for the regime switch | 14 |
| adxLongThreshold Longs: ADX above = breakout regime, below = mean reversion | 36 |
| adxShortThreshold Shorts: ADX above = breakout regime, below = mean reversion | 24 |
| atrMaxLong No longs when ATR is at or above this | 100 |
| atrMaxShort No shorts when ATR is at or above this | 200 |
| longReversionMultiplier Long after a down candle larger than this many ATRs | 1 |
| longBreakoutMultiplier Long after an up candle larger than this many ATRs | 1 |
| shortReversionMultiplier Short after an up candle larger than this many ATRs | 1 |
| shortBreakoutMultiplier Short after a down candle larger than this many ATRs | 2 |
| maxBarsLong Close a long after this many bars | 30 |
| maxBarsShort Close a short after this many bars | 5 |
| midMonthDay Days up to this count as the first half of the month | 15 |
| janFirstHalf Seasonal weight, first half of January (zero blocks new longs) | 3 |
| janSecondHalf Seasonal weight, second half of January (zero blocks new longs) | 0 |
| febFirstHalf Seasonal weight, first half of February (zero blocks new longs) | 3 |
| febSecondHalf Seasonal weight, second half of February (zero blocks new longs) | 3 |
| marFirstHalf Seasonal weight, first half of March (zero blocks new longs) | 3 |
| marSecondHalf Seasonal weight, second half of March (zero blocks new longs) | 2 |
| aprFirstHalf Seasonal weight, first half of April (zero blocks new longs) | 3 |
| aprSecondHalf Seasonal weight, second half of April (zero blocks new longs) | 3 |
| mayFirstHalf Seasonal weight, first half of May (zero blocks new longs) | 1 |
| maySecondHalf Seasonal weight, second half of May (zero blocks new longs) | 1 |
| junFirstHalf Seasonal weight, first half of June (zero blocks new longs) | 1 |
| junSecondHalf Seasonal weight, second half of June (zero blocks new longs) | 2 |
| julFirstHalf Seasonal weight, first half of July (zero blocks new longs) | 3 |
| julSecondHalf Seasonal weight, second half of July (zero blocks new longs) | 2 |
| augFirstHalf Seasonal weight, first half of August (zero blocks new longs) | 2 |
| augSecondHalf Seasonal weight, second half of August (zero blocks new longs) | 3 |
| sepFirstHalf Seasonal weight, first half of September (zero blocks new longs) | 3 |
| sepSecondHalf Seasonal weight, second half of September (zero blocks new longs) | 0 |
| octFirstHalf Seasonal weight, first half of October (zero blocks new longs) | 3 |
| octSecondHalf Seasonal weight, second half of October (zero blocks new longs) | 2 |
| novFirstHalf Seasonal weight, first half of November (zero blocks new longs) | 1 |
| novSecondHalf Seasonal weight, second half of November (zero blocks new longs) | 3 |
| decFirstHalf Seasonal weight, first half of December (zero blocks new longs) | 3 |
| decSecondHalf Seasonal weight, second half of December (zero blocks new longs) | 2 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| FTSE 100Best run | 4 hours | 1.17 | 1,514 | 55.75 | 7,580 EUR | -1,646 |
| DAX 40 | Daily | n/a | 347 | 58.21 | 9,871 EUR | -2,471 |
| GBP/USD | Daily | n/a | 799 | 55.69 | 7,847 USD | -7,788 |
| Nasdaq 100 | Daily | n/a | 585 | 50.77 | 2,959 EUR | -1,721 |
Charts
The code
// ============================================================ // DAX Survivor // ProRealAlgos Strategy Library | prorealalgos.com // Type: Volatility // Direction: Long & short // Timeframe tested: 4 hours // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade atrPeriod = 14 // ATR length for candle size and volatility cap adxPeriod = 14 // ADX length for the regime switch adxLongThreshold = 36 // longs: ADX above = breakout regime, below = mean reversion adxShortThreshold = 24 // shorts: ADX above = breakout regime, below = mean reversion atrMaxLong = 100 // no longs when ATR is at or above this atrMaxShort = 200 // no shorts when ATR is at or above this longReversionMultiplier = 1 // long after a down candle larger than this many ATRs longBreakoutMultiplier = 1 // long after an up candle larger than this many ATRs shortReversionMultiplier = 1 // short after an up candle larger than this many ATRs shortBreakoutMultiplier = 2 // short after a down candle larger than this many ATRs maxBarsLong = 30 // close a long after this many bars maxBarsShort = 5 // close a short after this many bars midMonthDay = 15 // days up to this count as the first half of the month // Seasonal weights per half month. Only zero matters now: zero blocks new longs. janFirstHalf = 3 janSecondHalf = 0 febFirstHalf = 3 febSecondHalf = 3 marFirstHalf = 3 marSecondHalf = 2 aprFirstHalf = 3 aprSecondHalf = 3 mayFirstHalf = 1 maySecondHalf = 1 junFirstHalf = 1 junSecondHalf = 2 julFirstHalf = 3 julSecondHalf = 2 augFirstHalf = 2 augSecondHalf = 3 sepFirstHalf = 3 sepSecondHalf = 0 octFirstHalf = 3 octSecondHalf = 2 novFirstHalf = 1 novSecondHalf = 3 decFirstHalf = 3 decSecondHalf = 2 // --- Indicators --- atrValue = AverageTrueRange[atrPeriod] adxValue = ADX[adxPeriod] candleBody = abs(open - close) longVolatilityOk = atrValue < atrMaxLong shortVolatilityOk = atrValue < atrMaxShort longBreakoutRegime = adxValue > adxLongThreshold longReversionRegime = adxValue < adxLongThreshold shortBreakoutRegime = adxValue > adxShortThreshold shortReversionRegime = adxValue < adxShortThreshold firstHalf = Day <= midMonthDay IF CurrentMonth = 1 THEN IF firstHalf THEN seasonWeight = janFirstHalf ELSE seasonWeight = janSecondHalf ENDIF ELSIF CurrentMonth = 2 THEN IF firstHalf THEN seasonWeight = febFirstHalf ELSE seasonWeight = febSecondHalf ENDIF ELSIF CurrentMonth = 3 THEN IF firstHalf THEN seasonWeight = marFirstHalf ELSE seasonWeight = marSecondHalf ENDIF ELSIF CurrentMonth = 4 THEN IF firstHalf THEN seasonWeight = aprFirstHalf ELSE seasonWeight = aprSecondHalf ENDIF ELSIF CurrentMonth = 5 THEN IF firstHalf THEN seasonWeight = mayFirstHalf ELSE seasonWeight = maySecondHalf ENDIF ELSIF CurrentMonth = 6 THEN IF firstHalf THEN seasonWeight = junFirstHalf ELSE seasonWeight = junSecondHalf ENDIF ELSIF CurrentMonth = 7 THEN IF firstHalf THEN seasonWeight = julFirstHalf ELSE seasonWeight = julSecondHalf ENDIF ELSIF CurrentMonth = 8 THEN IF firstHalf THEN seasonWeight = augFirstHalf ELSE seasonWeight = augSecondHalf ENDIF ELSIF CurrentMonth = 9 THEN IF firstHalf THEN seasonWeight = sepFirstHalf ELSE seasonWeight = sepSecondHalf ENDIF ELSIF CurrentMonth = 10 THEN IF firstHalf THEN seasonWeight = octFirstHalf ELSE seasonWeight = octSecondHalf ENDIF ELSIF CurrentMonth = 11 THEN IF firstHalf THEN seasonWeight = novFirstHalf ELSE seasonWeight = novSecondHalf ENDIF ELSE IF firstHalf THEN seasonWeight = decFirstHalf ELSE seasonWeight = decSecondHalf ENDIF ENDIF // The weight used to scale size; with fixed size a zero weight still means "no long". seasonAllowsLong = seasonWeight <> 0
35 more lines: the entry and exit rules.
Setup
Questions
Yes. The rewritten code has not been compile-checked yet and the published stats come from the earlier code, so test it in demo before going live.
FTSE 100 4 hours made EUR 7,579.90 over 1,514 trades. DAX 40 Daily made EUR 9,870.90, GBP/USD Daily USD 7,847.10 and Nasdaq 100 Daily EUR 2,959.40.
The best run's max drawdown at 1 contract was EUR 1,645.70. With no stop in place, keep extra room above that figure.
Holding periods of 30 and 5 bars need slower bars to capture a real swing. All tested rows were 4 hour or Daily.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.