Commit graph

2 commits

Author SHA1 Message Date
a8611dc48d fix: resolve M5 parameter conflicts and align config with user inputs
CHANGES:
- InitializeM5BarCountingMode(): Replace hardcoded boolean overrides with
  input-driven values (InpBreakevenEnabled, InpPartialEnabled,
  InpTrailingMethod, InpTrailDistance, InpTrailStep, InpAdaptiveTrailing)
- ConfigureContrarianMode(): Update preset to respect global inputs instead
  of hardcoded values
- ApplyM5ContrarianManagement() - Phase 1: Add m_config.breakeven_enabled
  check before executing BE
- ApplyM5ContrarianManagement() - Phase 2: Add m_config.breakeven_enabled
  check and wrap partials in if(m_config.partial_enabled) block
- Remove undeclared config.use_technical_exits field reference

BEHAVIOR:
- M5 mode now respects global enable/disable flags set in EA inputs
- Delayed breakeven and trailing delays preserved (InpMinBarsBeforeBE,
  InpMinBarsBeforeTrail remain M5-specific)
- Graduated stop-loss (3.5→2.5→2.0 ATR) and phase-based management unchanged
- Test reports now accurately reflect enabled/disabled features

FIXES:
- Configuration now matches tester report flags
- User can disable BE or partials in M5 mode via global inputs
- Prevents undefined behavior from conflicting hardcoded vs input values
2026-03-04 16:04:16 +00:00
bd91767a97 The M5 contrarian mode now respects global enable flags while preserving specialized delay logic.
Changes Applied
1. ERMT_PME_2.1_M5.mq5 - InitializeM5BarCountingMode()

config.breakeven_enabled = InpBreakevenEnabled (was: true hardcoded)
config.partial_enabled = InpPartialEnabled (was: true hardcoded)
config.trailing_method = InpTrailingMethod (was: TRAIL_DYNAMIC hardcoded)
config.trail_distance = InpTrailDistance (was: 40 hardcoded)
config.trail_step = InpTrailStep (was: 15 hardcoded)
config.adaptive_trailing = InpAdaptiveTrailing (was: true hardcoded)
2. ERMT_PME_2.1_M5.mq5 - ConfigureContrarianMode()

Same pattern: All hardcoded booleans replaced with input-driven values
Preset now demonstrates best practices without overriding user choices
3. PositionManager_PME_Complete.mqh - Phase 1 Breakeven

Added m_config.breakeven_enabled && check before executing BE
Combined with existing delay logic: if(m_config.breakeven_enabled && be_allowed && ...)
4. PositionManager_PME_Complete.mqh - Phase 2 Maturity

Phase 2 BE: Added m_config.breakeven_enabled && check
Wrapped all partial closes in if(m_config.partial_enabled) { ... } block
Prevents unconditional execution when features disabled
Preserved M5-Specific Features
✓ Graduated stop-loss system (3.5→2.5→2.0 ATR)
✓ Delayed BE triggers (InpMinBarsBeforeBE, InpMinProfitBarsForBE)
✓ Delayed trailing (InpMinBarsBeforeTrail, InpTrailMinProfit)
✓ M5 partial thresholds (InpM5Partial1-4)
✓ Phase timings (60/180/300 bars)

Testing Recommendations
Verify Disabled Features:

Verify Enabled + Delayed Features:

Expected Backtest Report Alignment:
Now tester reports will show enabled/disabled flags matching actual runtime behavior.
2026-03-03 12:57:29 +00:00