Source of truth: backend/backtest/Fabio_orb_backtest.py (BacktestMode.RESEARCH), backend/backtest/fabio/settings.py, backend/backtest/fabio/engine.py, backend/backtest/fabio/signals.py, backend/backtest/fabio/reporting.py. Educational only - not advice.
Universe, Data, Instrument Model
- Universe: SPY, QQQ, NVDA.
- RTH assumptions: ET session, 5m signal bars, exits prefer 3m closes when available.
- VIX input: prior daily
^VIX close from yfinance (fallback 18 if missing).
- Options model: Black-Scholes, OPTION_DTE=1, IV_BASE=0.20, slippage/commission modeled.
Risk and Circuit Breakers
- VIX risk tiers: <14 not tradeable; 14-16 half risk; 16-20 normal; 20-28 aggressive; above 28 half.
- Risk cap
RISK_PCT_MAX=10%.
- Halt new entries if day P&L ≤ -2% day-start capital.
- Max 3 exits/day across symbols; 3-loss streak halves risk; max 3 simultaneous positions.
- Sizing:
risk_dollars / (entry_opt_px * 100), minimum 1 contract.
Opening Range and Day Filters
- OR = high/low from 09:30-09:44 ET on 5m bars.
- OR/ATR(14): skip below 8%; 0.75x for 8-15%; 1.0x for 15-60%; 0.75x above 60%.
- Gap filter: skip if gap ≥ 3.0%; if 1.5-3.0%, require OR boundary retest.
- Daily trend filter: bullish if EMA10>EMA20 and close>EMA50; counter-trend disabled.
Entry Rules (Research)
- Scan window: 09:45-14:00 ET on closed 5m bars.
- CALL: two consecutive closes above OR high. PUT: two consecutive closes below OR low.
- Entry gate: VIX ≥ 16.1.
- When 20<VIX≤28, CALL entries are skipped (PUT allowed).
Exit Rules
- Strategy exit (unless profit-locked): two closes past OR midpoint or EMA10/EMA20 cross against trade.
- Profit lock at 1.2x entry premium; trims and hard stop still active.
- Hard stop: 2x daily ATR adverse move from entry stock price.
- Trim ladder: 2x, 4x, 8x multiples; trim 50% of remaining contracts.
-
Primary bot EOD flatten: FABIO_EOD_CLOSE_BEFORE_SESSION_MINUTES (default 15) before
official XNYS session close; early-close days follow the exchange calendar.
Reported Portfolio Stats
- Core: count, wins/losses, win rate, avg win/loss, profit factor, expectancy, total P&L/return, max drawdown, Sharpe, final capital.
- Slices: by exit reason, direction, trend, symbol.
- Artifacts:
Fabio_backtest_trades.csv, Fabio_backtest_equity.csv, Fabio_backtest_report.png.