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>
This commit is contained in:
Brent Neale
2026-02-17 15:18:02 +10:00
co-authored by Claude Opus 4.6
parent d843e63e7b
commit b1f3a919bf
11 changed files with 1017 additions and 114 deletions
+6
View File
@@ -0,0 +1,6 @@
OANDA_API_KEY=your-oanda-api-key-here
OANDA_ACCOUNT_ID=your-account-id-here
OANDA_ENV=practice
DASHBOARD_PASSWORD=changeme
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key-here
+14 -3
View File
@@ -40,12 +40,23 @@ ai:
rsi_oversold: 20
volatility_multiplier: 3.0
strategy:
rule: sma_cross
rule: pivot_retest_engulfing
params:
short: 50
long: 100
sma_period: 50
lookback_bars: 20
retest_tolerance_atr: 0.5
strong_close_pct: 0.30
sl_atr_multiplier: 1.5
trade_size_pct_of_equity: 0.025
max_drawdown_pct: 0.05
# Previous strategy (uncomment to switch back):
# strategy:
# rule: sma_cross
# params:
# short: 50
# long: 100
# trade_size_pct_of_equity: 0.025
# max_drawdown_pct: 0.05
execution:
paper_mode: true
canary_size_pct: 0.01