feat(backtest): ATR quality filter, pre-fill invalidation, entry zone config

Backtest improvements (XAUUSDm 20k candles vs baseline PF 1.12):
- ATR filter: FVG zone >= 0.3× ATR(14), impulse body >= 1.0× ATR(14) → PF 1.29, DD -3358
- Pre-fill invalidation: cancel pending FVG if price closes past impulse SL → PF 1.17
- ATR + pre-fill combined: PF 1.32, lowest DD -3230 (best overall)
- Entry zone config (ENTRY_ZONE_PCT): 0.0 aggressive / 0.5 midpoint / 1.0 conservative
  - Aggressive (0.0) hurts severely (PF 0.84), conservative (1.0) raises WR to 52.8%

New env vars: MIN_FVG_ATR_RATIO, MIN_IMPULSE_ATR_RATIO, PRE_FILL_INVALIDATE, ENTRY_ZONE_PCT
Rolling ATR(14) added to helpers using Wilder's RMA smoothing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
romysaputrasihananda
2026-06-12 01:44:58 +07:00
co-authored by Claude Sonnet 4.6
parent 272fca4f65
commit 9157c0d4f6
4 changed files with 170 additions and 13 deletions
+12
View File
@@ -55,6 +55,18 @@ BACKTEST_CANDLES=50000
# 0 = disabled, 0.03 = stop after -3% day
# DAILY_LOSS_LIMIT_PCT=0.03
# ATR quality filters (backtest + live): reject weak FVGs/impulses.
# Backtest shows ATR filter improves PF from 1.12 → 1.29 on XAUUSDm 20k candles.
# MIN_FVG_ATR_RATIO=0.3 # FVG zone must be >= 0.3× ATR(14)
# MIN_IMPULSE_ATR_RATIO=1.0 # Impulse candle body must be >= 1.0× ATR(14)
# Pre-fill invalidation: cancel pending FVG if price closes past impulse SL before fill.
# Combined with ATR filter: PF 1.32, lowest DD. Recommended.
# PRE_FILL_INVALIDATE=true
# Entry zone within FVG: 0.0 = zone edge (aggressive), 0.5 = midpoint (default), 1.0 = far edge (conservative).
# ENTRY_ZONE_PCT=0.5
# ── Telegram Notifications ───────────────────────────────────────────────────
# Get token from @BotFather, chat_id from @userinfobot or Telegram API.
# All three are optional — omit to disable notifications.