Skip to content

fix: normalize ATR_max/ATR_min to pips — currently broken for all non-XAUUSD symbols #64

Description

@cfournel

Problem

ATR_max and ATR_min inputs compare against raw iATR() output in native price units. The default ATR_max=8.2 was calibrated for XAUUSD (M15 ATR ~3-8 USD). For every other symbol the filter is completely inert:

Symbol M15 ATR range ATR_max=8.2 effect
XAUUSD 3–8 ✅ sometimes triggers
EURUSD 0.0005–0.0012 ❌ never triggers
USDJPY 0.15–0.30 ❌ never triggers
EURJPY 0.10–0.25 ❌ never triggers
USDX 0.05–0.10 ❌ never triggers

Confirmed by backtests: changing ATR_max from 8.2 → 0.3 → 0.5 on USDX produces identical results (same 6 trades, same 0% WR).

Code location: OBInclude/OrderProcess.mqh lines 78-83:

if(atr[0] > ATR_max)
   return false;
if(ATR_min > 0 && atr[0] < ATR_min)
   return false;

Fix

Normalize ATR to pips before comparison so one threshold works across all symbols:

// Normalize: atr in pips = raw_atr / (_Point * 10)
// Works for 2-digit (XAUUSD), 3-digit (USDJPY/USDX), 5-digit (EURUSD) symbols
double atr_pips = atr[0] / (_Point * 10.0);
if(ATR_max > 0 && atr_pips > ATR_max) return false;
if(ATR_min > 0 && atr_pips < ATR_min) return false;

Then update inputs and all set files to use pip-based values:

  • ATR_max default: 80.0 (80 pips = ~$8 for XAUUSD ≈ current behavior)
  • ATR_min default: 0.0 (off by default)

Impact

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions