Een fractal high start een dalende trendlijn, en een break van die lijn in twee stappen activeert een buy stop 0.3 ATR(7) boven de recente high. De exits gebruiken een exponentiële band en RSI(2) en sluiten longs zodra RSI op 85 of hoger staat en de prijs terug onder de bovenste band is. Shorts spiegelen de logica.
Beste run van 8. USD/JPY, 4 uur, spread 1, uit run sweeps:2026-09-17-USDJPY-4h-opt.tsv:2.
| Periode | Tot 2026-09-17 |
| Instrument | USD/JPY, 4 uur |
| Spread | 1 punten |
| Contracten | 1 |
| Startkapitaal | 1,000,000 |
| Kosten | Alleen spread. Commissies en overnight financiering zijn niet meegerekend. |
| Bars | Tot 200,000 bars, minder waar het instrument minder historie heeft |
| Laatst getest | 2026-09-17 |
| positionSize Contracten per trade | 1 |
| fractalBars Bars die het midden van de 5-bar fractal moet overtreffen (structureel, houd op 4) | 4 |
| breakoutBars Bars die worden gebruikt voor de breakout high of low | 2 |
| atrPeriod ATR-lengte voor de instapbuffer | 7 |
| atrMultiplier Instapbuffer voorbij het breakoutniveau, in ATR's | 0.3 |
| bandPeriod Lengte van de exponentiële log-prijsbanden | 34 |
| seedPeriod SMA-lengte die de banden op de eerste bars vult | 3 |
| bandWidth Bandbreedte in standaarddeviaties | 1.618 |
| rsiPeriod RSI-lengte voor de exit | 2 |
| overboughtLevel RSI-niveau dat een longexit vereist | 85 |
| oversoldLevel RSI-niveau dat een shortexit vereist | 15 |
| lookbackPeriod Venster voor de voorgaande swing high en low | 100 |
Elke run
| Markt | Tijdframe | PF | Trades | Winst % | Netto | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBeste run | 4 uur | n/a | 819 | 53.36 | 161,440 JPY | -93,910 |
| USD/JPY | Dagelijks | n/a | 300 | 59.00 | 754,540 JPY | -174,840 |
| Nikkei 225 | Dagelijks | n/a | 262 | 61.07 | 20,201 USD | -12,694 |
| Zilver | Dagelijks | n/a | 255 | 50.59 | 8,055 USD | -2,895 |
| Brent-olie | Dagelijks | n/a | 119 | 60.50 | 4,755 EUR | -4,645 |
| GBP/USD | Dagelijks | n/a | 334 | 59.88 | 3,432 USD | -2,003 |
| FTSE 100 | Dagelijks | n/a | 297 | 54.55 | 2,325 EUR | -948 |
| Goud | Dagelijks | n/a | 287 | 55.05 | 624 EUR | -317 |
Grafieken
De code
// ============================================================ // Trend Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 4 hours // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade fractalBars = 4 // bars the centre of the 5-bar fractal must beat, keep at 4 breakoutBars = 2 // bars for the breakout high / low atrPeriod = 7 // ATR length for the entry buffer atrMultiplier = 0.3 // entry buffer beyond the breakout level, in ATRs bandPeriod = 34 // length of the log-price exponential bands seedPeriod = 3 // SMA used to seed the bands on early bars bandWidth = 1.618 // band width in standard deviations rsiPeriod = 2 // RSI length for the exit overboughtLevel = 85 // long exit needs RSI at or above this oversoldLevel = 15 // short exit needs RSI at or below this lookbackPeriod = 100 // window for the prior swing high / low // State, seeded so every value is defined on the first bar. ONCE fractalHighCount = 0 ONCE fractalLowCount = 0 ONCE trendBreak = 0 ONCE bearSetup = 0 ONCE bullSetup = 0 ONCE fractalHigh = 0 ONCE fractalLow = 0 ONCE fractalBar = 0 ONCE trendHeight = 0 ONCE closeHeight = 0 ONCE maxAngle = 0 ONCE logEma = 0 ONCE logVariance = 0 ONCE longExitArmed = 0 ONCE shortExitArmed = 0 // --- Indicators --- // Count how many of the last five bars the bar two back beats. FOR i = 0 TO fractalBars DO IF high[2] > high[i] THEN fractalHighCount = fractalHighCount + 1 ENDIF IF low[2] < low[i] THEN fractalLowCount = fractalLowCount + 1 ENDIF NEXT // A fractal high starts a bearish trend line, a fractal low a bullish one. IF fractalHighCount = fractalBars THEN IF bearSetup = 0 AND bullSetup = 0 THEN bearSetup = 1 ENDIF fractalHigh = high[2] fractalBar = BarIndex - 2 ENDIF IF fractalLowCount = fractalBars THEN IF bearSetup = 0 AND bullSetup = 0 THEN bullSetup = 1 ENDIF fractalLow = low[2] fractalBar = BarIndex - 2 ENDIF fractalHighCount = 0 fractalLowCount = 0 IF bearSetup = 1 THEN trendHeight = fractalHigh - high closeHeight = fractalHigh - close ELSIF bullSetup = 1 THEN trendHeight = low - fractalLow closeHeight = close - fractalLow ENDIF // Track the steepest angle of the trend line from the fractal, then detect // a two-step break of that line (trendBreak 1, then 2). IF BarIndex - 2 = fractalBar THEN maxAngle = Tan(2 / trendHeight) ENDIF IF BarIndex - 2 > fractalBar THEN IF bearSetup = 1 THEN IF Tan((BarIndex - fractalBar) / trendHeight) > maxAngle AND (close < open OR close < close[1]) THEN maxAngle = Tan((BarIndex - fractalBar) / trendHeight) trendBreak = 0 ENDIF IF trendBreak = 0 AND Tan((BarIndex - fractalBar) / closeHeight) > maxAngle AND close > open THEN trendBreak = 1 ELSIF trendBreak = 1 AND Tan(((BarIndex - 1) - fractalBar) / closeHeight) > maxAngle AND close > close[1] THEN trendBreak = 2 ENDIF ELSIF bullSetup = 1 THEN IF Tan((BarIndex - fractalBar) / trendHeight) > maxAngle AND (close > open OR close > close[1]) THEN maxAngle = Tan((BarIndex - fractalBar) / trendHeight) trendBreak = 0 ENDIF IF trendBreak = 0 AND Tan((BarIndex - fractalBar) / closeHeight) > maxAngle AND close < open THEN trendBreak = 1 ELSIF trendBreak = 1 AND Tan(((BarIndex - 1) - fractalBar) / closeHeight) > maxAngle AND close < close[1] THEN trendBreak = 2 ENDIF ENDIF ENDIF atrValue = AverageTrueRange[atrPeriod](close)
Nog 67 regels: de instap- en uitstapregels.
Opzet
Vragen
Ja, de instappen zijn openstaande stop orders die één bar geldig zijn. De code is herschreven maar niet op compileerfouten gecontroleerd, en de statistieken komen uit de eerdere versie.
Alle zeven rijen waren winstgevend. USD/JPY Dagelijks maakte JPY 754,540 over 300 trades, en Nikkei 225 Dagelijks maakte USD 20,201.20.
Bij 1 contract had de beste run een max drawdown van JPY 93,910. Gold Dagelijks was veel kleiner met EUR 317.10.
Trendlijnen die vanaf fractals worden getekend hebben genoeg bars tussen de swingpunten nodig. Elke geteste rij gebruikte 4 uur- of dagbars.
Gerelateerd
De ProRealAlgos community krijgt de volledige regels, de complete code en de geautomatiseerde portefeuille.