49 Commits

Author SHA1 Message Date
Brent Neale 17b80b7d17 Add 5 new ranging strategies (S17-S21) — all tested, none show edge
Implemented and backtested 5 ranging-market M15 strategies across
3 periods (Training 2021-2023, Test Set 2023-2024, 2025) and 4 pairs
(EUR_USD, GBP_USD, GBP_JPY, GBP_AUD). All 5 fail Phase 1 validation:

- S17 BB Rejection: PF 0.55-0.92, -1208p on 2025 (347 trades)
- S18 Failed Breakout: PF 0.53-0.84, -1905p on 2025 (747 trades)
- S19 VWAP Deviation: PF 0.23-1.65, -87p on 2025 (37 trades)
- S20 Range Compression: only 5 trades on 2025 (too restrictive)
- S21 EMA Ribbon Bounce: PF 0.64-0.89, -3358p on 2025 (1088 trades)

Also added midnight-reset VWAP indicator and downloaded 2025 M15 data
for EUR_USD, GBP_JPY, GBP_AUD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 20:48:03 +10:00
Brent Neale 935e02bdc6 Add held-out test set validation and S3 multi-pair expansion
Test set (Sep 2023 - Dec 2024): only S9_Filtered passes (PF=1.13),
portfolio PF=0.91 FAIL. S3 expansion to GBP_USD, EUR_USD, GBP_AUD
shows no generalization — GBP_JPY remains the only viable pair.
No strategy is consistently profitable across all 4 validation periods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:41:44 +10:00
Brent Neale c8ec99c4e4 Add 2025 forward validation report with full trade analysis
Comprehensive report comparing IS (2021-2022), OOS (2023), and 2025
performance across all 4 Phase 2 strategies. Includes per-trade logs,
period comparison tables, and root cause analysis for each strategy's
2025 performance. Key finding: only S3 survived, high Phase 2
generalization scores correlated with regime sensitivity not robustness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:08:14 +10:00
Brent Neale 8df1bac3a4 Add 2025 forward validation: only S3 survives out of 4 strategies
Downloaded 2025 data (Oct 2024-Dec 2025) for GBP_JPY H1, GBP_AUD H1,
GBP_USD M15+H1 via Dukascopy. Ran all 4 Phase 2 passing strategies on
2025 data. Results: S7_Tight PF=0.52 FAIL, S9_Filtered PF=0.74 FAIL,
S3 PF=1.05 PASS (+52p), S8_OB PF=0.84 FAIL. Portfolio PF=0.83 (-373p).
Only S3 (Key Level Breakout) maintained edge into 2025.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:00:22 +10:00
Brent Neale a4ec5fb0a5 Add M5 data pipeline and test S12/S15/S16 on 5-minute data
Downloaded M5 data via Dukascopy for GBP_JPY, GBP_USD, EUR_USD, USD_JPY
(~200k bars each, 2021-2024). Added M5 to validate_and_split pipeline.
Tested S12 (Asian Range Sweep), S15 (Momentum Continuation), S16 (London
ORB) with M5-scaled parameters. No viable edge found — best result was
S16_GBP_JPY OOS PF=1.03 but IS was negative (PF=0.71).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 11:34:12 +10:00
Brent Neale 7657d4b1b3 Add 5 new strategies (S12-S16) — all tested, none show edge on M15
Implemented and backtested 5 new strategies adapted to M15 timeframe:
- S12 Asian Range Sweep (best OOS PF 0.66)
- S13 Bollinger-Keltner Squeeze (best OOS PF 0.79)
- S14 London Fix post-fix reversal (best OOS PF 0.52)
- S15 Momentum Continuation (best OOS PF 0.87)
- S16 London ORB (best OOS PF 0.63)

Added Bollinger Bands and Keltner Channels to indicator pipeline.
None passed generalization — these strategies need M5/M30 data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 06:57:29 +10:00
Brent Neale ad58e3be0c Update regime analysis for 4-strategy portfolio
S7: UP (1.26->1.80), S9F: UP (0.58->2.26), S3: STABLE (1.16->1.23),
S8_OB: UP (0.66->1.59). Three of four strategies show improving edge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 00:38:30 +10:00
Brent Neale 33369f9151 Update Kelly sizing for 4-strategy portfolio
All strategies positive Kelly, 0% ruin at half-Kelly.
S7: 13.7%, S9F: 9.5%, S3: 5.1%, S8_OB: 6.1% (half-Kelly).
S8_OB best risk profile: p95 DD only 1.8% with 2.11 W/L ratio.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:40:11 +10:00
Brent Neale 9f32948caf Update correlation analysis for 4-strategy portfolio
Avg pairwise PnL correlation: 0.028 (excellent diversification).
S7/S3 signal overlap on GBP_JPY only 6.5%. Portfolio: 289 trades,
PF=1.37, Sharpe=1.29, +1,732 pips ($+23,424), max DD -21%.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:28:17 +10:00
Brent Neale 98cc843d14 Update S8_OB to best sweep params (DISP=2.5, TP1=2.0, Window=40)
IS PF improved from 1.02 to 1.39, reducing IS/OOS divergence.
Portfolio: IS +1,089 pips PF=1.31, OOS +643 pips PF=1.55, Gen=1.473 PASS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:12:43 +10:00
Brent Neale 23d8288fa3 Update param sweep results with S8_OB grid (27 combos)
S8_OB PASS: best params DISP_ATR=2.5, TP1=2.0, Window=40
(IS PF=1.39, OOS PF=1.59, Gen=1.382). S9_Filtered also PASS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:02:12 +10:00
Brent Neale ea5472b737 Add S8 Order Block (GBP_USD/M15) to Phase 2 portfolio
Tested all 9 untested strategies across 22 pair combos. S8 Order Block
on GBP_USD was the standout: OOS PF=2.14, WR=65.4%, Gen=1.850 PASS.
Parameter sweep confirmed DISPLACEMENT_ATR=2.0, TP1_ATR_MULT=1.0,
OB_RETEST_WINDOW=40 as best params (all top-5 PASS OOS validation).

Portfolio now 4 strategies: S7_Tight, S9_Filtered, S3, S8_OB.
OOS portfolio: 82 trades, PF=1.61, WR=64.6%, Sharpe=2.98, +672 pips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:00:30 +10:00
Brent Neale bdab78ee48 Add S10 VWAP Mean Reversion and S11 ADX Trend Pullback strategies, drop both from portfolio
Implemented two M15 intraday strategies to diversify the portfolio:
- S10: VWAP mean reversion in ranging markets (ADX<30, RSI(9) extremes)
- S11: ADX trend pullback to 20 EMA in strong trends (ADX>30, rising)

Added rsi_9 and atr_10 to the indicator pipeline for both strategies.

Backtested on IS (2021-2022) and OOS (2023): both strategies produced
insufficient trade counts on M15 and failed generalization. S10 best
result was EUR_GBP at Gen 0.65 (WARN). S11 collapsed to 0% WR OOS
across all param sweep combos. Both dropped from active portfolio —
3-strategy core (S7_Tight, S9_Filtered, S3) remains unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:23:23 +10:00
Brent Neale 410a10acb6 Drop S4F and S9 from param sweep to match 3-strategy portfolio
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:27:11 +10:00
Brent Neale 9c5d55ec46 Refine Phase 2 portfolio: data-driven filters, drop S4F and S9
S7: add RSI floor (RSI<40 = 0% WR) and ATR percentile cap (high-vol
regime = worse RR). IS flips from PF 0.68 to 1.52, OOS holds at 1.80.

S3: add confluence gate (C>=4) and skip hours 09-10 (0% WR). IS PF
1.06 -> 1.22, OOS PF 1.07 -> 1.23.

S9_Filtered: add skip_monday (unreliable Asian ranges after weekend
gaps). IS PF 1.10 -> 1.31, OOS holds strong at 2.26.

Drop S9/GBP_USD (negative PF across all param combos) and S4F/EUR_AUD
(overfit: IS 1.43 collapses to OOS 0.48). 3-strategy portfolio: all
PASS generalization, IS PF 1.29, OOS PF 1.55, Gen 1.46.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:25:09 +10:00
Brent Neale 4f911b2072 Add Phase 2 backtesting pipeline: IS/OOS split, param sweep, generalization scoring
Externalize hardcoded params in S4F (5 params) and S3 (9 params) as class
attributes for sweep compatibility. Add unified backtest runner with IS/OOS
validation and generalization scores, plus parameter grid sweep (90 combos)
with OOS validation. S7/S9/S9_Filtered pass generalization; S4F/S3 confirm
defaults are near-optimal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:25:08 +10:00
BrentNeale1 9d16939eaa Add files via upload 2026-02-20 10:23:16 +10:00
Brent Neale f705348e54 Update README with Railway deployment details
Add Railway cloud deployment section with service URLs, env vars,
persistent volume, and known limitations. Update project structure
with railway.toml and health.py. Update dashboard and bot run sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:10:09 +10:00
Brent Neale 0cf9c90197 Update dashboard Status page to show Phase 2 strategy slots
Replaces legacy config display with Phase 2 engine info: strategy
slots table, starting equity, max daily DD, poll interval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:02:37 +10:00
Brent Neale c65f039dcb Remove SRI integrity checks from Bootstrap CDN links
Fixes Bootstrap CSS not loading on Railway deployment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:57:56 +10:00
Brent Neale 4e2db68049 Add Railway deployment config for 24/7 cloud paper trading
- Dockerfile: add templates copy, ENV PORT, update CMD to live engine
- Create src/live/health.py: threaded HTTP health server (/health, /state)
- Wire health server into src/live/run.py before engine loop
- Dashboard: add unauthenticated /health endpoint, use PORT env var
- Create railway.toml with Dockerfile builder and health check config
- docker-compose.yml: rename service to live-engine, add PORT env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:53:54 +10:00
Brent Neale 65ac3b296a Update README with Phase 2 setup guide and analytics summary
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:55:57 +10:00
Brent Neale af994b0fbe Add Phase 1 trade preview PNGs, live engine state, remove master prompt PDF
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:54:04 +10:00
Brent Neale 3abcc1353c Fix Unicode box-drawing characters for Windows console compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:49:07 +10:00
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 39a6536284 Phase 1 complete: S7-S9 Smart Money strategies, expanded pair testing, consolidated scorecard
- S7 Liquidity Sweep: built, tested across 6 pairs, tight SL (1.0 ATR) on GBP_JPY
  is Phase 2 candidate (107 trades, OOS PF 1.39, gen ratio 1.81)
- S8 Order Block: built, tested on GBP_JPY (watchlist, 32 trades, OOS PF 1.55)
- S9 London Session: built, tested across 8 pairs with filter experiments
  GBP_USD (OOS PF 1.45) and GBP_AUD filtered (OOS PF 1.94) advance to Phase 2
- Added OBV indicator to technical.py
- Added GBP_NZD to engine spread/pip config
- Standalone OANDA fetcher (bypasses Supabase dependency)
- Fetched EUR_GBP, EUR_USD, GBP_NZD H1 data (2021-2023)
- Consolidated STRATEGY_LEARNINGS.md with full Phase 1 scorecard and 11 design principles
- Phase 2 roster: S7/GBP_JPY, S9/GBP_USD, S9F/GBP_AUD, S4-F/EUR_AUD, S3/GBP_JPY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:56:03 +10:00
BrentNeale1 70a216d695 Add files via upload 2026-02-19 10:08:41 +10:00
Brent Neale 32aeca22a3 Add resources folder for external learning documents
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 10:07:50 +10:00
BrentNeale1 5266f076d4 Add files via upload 2026-02-18 21:11:44 +10:00
Brent Neale edbe359d1b Phase 1 complete: S3-S6 strategies, S4 variant analysis, learnings doc
- S3 Key Level Breakout: best performer (52-53% WR, PF ~1.0 on JPY crosses)
- S4 EMA Ribbon: tested 7 variants (D/E/F/F-v2/G/G-Minimal), exhausted
  - Only EUR_AUD S4-F marginally profitable (PF 1.06)
  - Detailed filter funnel analysis revealed contradictory filter stacking
- S5 Momentum Exhaustion: extended to 5 pairs, PF 0.43-0.77
- S6 EMA Bounce: 59-60% WR but PF 0.83-0.84, needs SL/TP restructuring
- Added STRATEGY_LEARNINGS.md with design principles and next steps
- Added M5 data downloader for 3-timeframe strategies
- Updated README with full strategy scorecard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:42:16 +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
BrentNeale1 5d7f6c60a9 Add files via upload 2026-02-17 22:53:49 +10:00
BrentNeale1 a3a61d61d1 Add files via upload 2026-02-17 21:29:21 +10:00
Brent Neale 311881afa8 Update README with economic calendar docs and pending TE API key status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:15:57 +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 d843e63e7b Add pivot point support/resistance chart to dashboard
Add Classic Pivot Points (P, R1-R3, S1-S3) computed from previous day's
OHLC data, displayed as horizontal lines on an interactive Plotly.js
candlestick chart at /chart with instrument/granularity selectors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:28:58 +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 426f5e7d49 Add paper trading order executor with kill switch and order logging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:11:19 +10:00
Brent Neale 187ebe9a9e Add backtesting engine with SMA cross strategy
Reads features from Supabase, simulates SMA(3)/SMA(20) crossover signals,
and outputs P&L, drawdown, and trade logs per instrument/granularity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:58:00 +10:00
Brent Neale 31c74d4e5f Add project settings, master prompt PDF, and test connection script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:44:51 +10:00
Brent Neale 71f9c7849b Fix NaN serialization and upsert response handling in upload
Sanitize NaN/inf values that pandas re-introduces into float columns
after conversion, preventing JSON serialization errors. Fix upsert
response check to detect success via resp.data instead of status_code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:42:17 +10:00
Brent Neale da64544d3a Add granularity tracking, drop intermediate columns, add SQL schema
Track granularity (M1/M5) through the pipeline so rows are
distinguishable after upload. Drop helper columns (tr, typical_price,
pv) from the feature DataFrame. Add SQL schema with composite PK on
(time, instrument, granularity).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:34:13 +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
Brent Neale 256dffaae1 Update environment requirements 2026-02-16 13:16:51 +10:00
Brent Neale e459eaed2c Setup environment 2026-02-16 13:07:12 +10:00
BrentNeale1 cdc5df8a81 Initial commit 2026-02-16 13:01:24 +10:00