8 Commits

Author SHA1 Message Date
Brent Neale 072ac0f245 Phase 2: Live paper trading engine + extended backtesting analytics
Track A — Live paper trading system:
- Extract PositionManager from backtester into shared src/position_manager.py
- Refactor backtester/engine.py to delegate to PositionManager
- New src/live/ package: data_feed (OANDA polling), executor (paper/live orders),
  engine (LiveEngine orchestrator with 5 strategy slots), run.py entry point
- Add phase2 config to system.yaml (S7_Tight, S9, S9_Filtered, S4F, S3)

Track B — Extended backtesting analytics:
- Regime analysis: per-year (2021-2023) breakdown shows 4/5 strategies trending UP
- Correlation analysis: S7+S3 GBP_JPY overlap=16.9% (moderate), S9 pairs=12% (low)
- Kelly sizing: S9_Filtered half-Kelly=7.3%, S4F=2.4%, S3=1.6% with Monte Carlo DD

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:46:51 +10:00
Brent Neale dce54845c2 Phase 1: Event-driven backtester, 5 strategies, and baseline results
- Built event-driven backtesting engine with spread/slippage modeling,
  3-TP partial closes, trailing stops, and rich trade logging (20+ features)
- Implemented 5 strategy signal generators (MA Breakout, VWAP Reversal,
  Key Level Breakout, EMA Ribbon Scalp, Momentum Exhaustion)
- Full indicator library (EMA, SMA, RSI, ATR, MACD, ADX, Stochastic,
  Session VWAP bands, swing points, key levels, RSI divergence)
- Data pipeline: Dukascopy download, validation, 70/30 train/test split
- Baseline results: all 5 strategies generate 200+ trades on training data
  (Jan 2021 - Aug 2023), best profit factors 0.82-0.96 on select pairs
- Trade logs and reports saved for Phase 3 ML feature engineering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:04:40 +10:00
Brent Neale 546d7311ec Add economic calendar module to filter trades near high-impact events
Introduces a full Trading Economics API pipeline that fetches, stores, and
queries economic events (NFP, CPI, rate decisions, etc.) so the backtester
can block trade entries within a configurable buffer window of high-impact
releases — reducing slippage and false signals.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:00:28 +10:00
Brent Neale b1f3a919bf Add pivot retest + engulfing strategy with dual take-profit
New strategy (pivot_retest_engulfing) that enters long/short trades at
pivot level retests confirmed by SMA 50 alignment and engulfing candle
patterns. Uses ATR-based stop loss with two take-profit levels — at TP1
half the position closes and SL moves to breakeven, at TP2 the rest closes.

- data_engine: add detect_engulfing() for bullish/bearish pattern detection
- backtester: add generate_signals_pivot_retest(), run_backtest_dual_tp(),
  update signal dispatcher and metrics for dual-TP trade format
- order_executor: support signal=-1 (SHORT), attach SL/TP levels
- config: switch to pivot_retest_engulfing with default params
- chart_trades: new mplfinance script to visualize entries on candlesticks
- README: rewrite with full setup guide, project structure, strategy docs
- requirements.txt: make portable (remove conda file:// paths), add mplfinance
- .env.example: add template for secrets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:18:02 +10:00
Brent Neale f4734f57c7 Optimize strategy to SMA 50/100 with RSI 80/20 filtering
Added parameter sweep tool that tested 320 combinations across SMA periods,
trade sizes, and RSI filters. Best result: SMA 50/100 on M15 with RSI 80/20
(Sharpe 5.69, 49% win rate). Updated backtester with RSI overbought/oversold
signal filtering and config to match optimal parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:17:55 +10:00
Brent Neale 212f581d01 Add web dashboard, historical data loader, and backtest reporting
- Add Flask dashboard with status, config editor, logs, kill switch,
  and backtest results pages with monthly P&L breakdowns
- Add historical_loader.py for paginated OANDA candle fetching (1yr+)
- Update backtester to $100k starting equity, monthly P&L computation,
  and JSON summary output for dashboard display
- Update config to EUR_USD only on M5/M15 with SMA 21/50 strategy
- Add backtest.html template with performance metrics and bar charts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:29:12 +10:00
Brent Neale ef950f25dd Add Docker setup with AI ensemble integration and execution loop
Dockerize the order executor with python:3.11-slim, add docker-compose
with config volume mount for hot-reload of system.yaml settings. Integrate
AI ensemble validation into order execution pipeline and add configurable
interval loop (default 60s) to replace container restart cycling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:19:20 +10:00
Brent Neale 0d0c363bfa Add config-driven system.yaml and multi-window indicators
- Create config/system.yaml with full master prompt template
- Create src/config_loader.py to load YAML config and .env
- Update data_engine.build_all_features() to support lists of windows
  (e.g. sma_windows: [3, 20] produces sma_3 and sma_20 columns)
- Rewrite get_candles.py to loop over all instruments × granularities
  from config instead of hardcoding EUR_USD/M5
- Fix supabase_upload.py indentation bug and wire up config for table name

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:22:07 +10:00