mql5/Profiles/Tester/ERMT_PME_2.1_M5.EURUSD.M5.20250101_20260227.000.ini
darashikoh 428fd88c60 feat(M5): Implement v2.1 config enforcement and graduated stops in M5 contrarian mode
BREAKING CHANGES:
- M5 mode now enforces all v2.1 delayed BE/trailing parameters
- Graduated stop system replaces legacy disaster stop when enabled
- Max bars limit now triggers hard position close

Changes to PositionManager_PME_Complete.mqh:

1. Max Bars Hard Close Enforcement
   - Added check for m_m5_config.max_bars at start of ApplyM5ContrarianManagement()
   - Forces EXIT_TIME close when position age exceeds configured limit (300 bars)
   - Prevents indefinite position holding in extended phases

2. Graduated Stop-Loss System
   - Implements ATR-based phase-progressive stops:
     * Phase 1 (0-60 bars): 3.5 ATR wide initial protection
     * Phase 2 (60-180 bars): 2.5 ATR tightened stop
     * Phase 3 (180+ bars): 2.0 ATR mature stop
   - Replaces legacy disaster stop when m_config.use_graduated_stops enabled
   - Falls back to disaster stop (150pt @ -100pt) if graduated stops disabled
   - Updates m_positions[].current_sl after successful modification

3. Delayed Breakeven Enforcement (v2.1)
   - Respects m_config.breakeven_min_bars (20 bars minimum age)
   - Respects m_config.breakeven_min_profit_bars (5 consecutive profit bars)
   - Applied to both Phase 1 fast BE (25pts) and Phase 2 maturity BE (30pts)
   - Logs bar count and consecutive profit bars on activation

4. Delayed Trailing Enforcement (v2.1)
   - Respects m_config.trail_min_bars (40 bars minimum age)
   - Applied to percentage trail in Phase 2 (30%/40% based on reversal speed)
   - Sets trail_activated flag and increments m_metrics.trails_activated
   - Logs activation with percentage and bar count

5. M5 Trailing Helper Metric Sync
   - Created ApplyM5PercentageTrail() with current_sl sync
   - Created ApplyM5PointsTrail() with current_sl sync
   - Created ApplyM5DynamicTrail() with current_sl sync
   - Standard helpers (ApplyPercentageTrail, etc.) preserved for non-M5 use
   - M5 contrarian management now calls M5-specific versions exclusively
   - Fixes metric/state desync between MT5 server and in-memory position tracking

Architecture:
- M5 mode continues to bypass standard management path (intentional isolation)
- Standard trailing/technical/time-exit engines remain unused in M5 mode
- Configuration separation maintained: ManagementConfig for standard + v2.1 fields, M5Config for contrarian-specific
- No changes to main EA file (ERMT_PME_2.1_M5.mq5)

Compatibility:
- No breaking changes to standard (non-M5) management path
- Existing M5 backtest results remain valid (behavior refinement only)
- All v2.1 configuration fields now honored in M5 runtime
2026-03-02 17:08:42 +00:00

117 lines
9 KiB
INI

;Expert Advisor single test: ERMT_PME_2.1_M5, EURUSD M5, every tick, 2025.01.01 - 2026.02.27
[Tester]
Expert=Advisors\ERMT_PMEx\ERMT_PME_2.1_M5.ex5
Symbol=EURUSD
Period=M5
Optimization=0
Model=0
FromDate=2025.01.01
ToDate=2026.02.27
ForwardMode=0
Deposit=1000
Currency=USD
ProfitInPips=0
Leverage=100
ExecutionMode=8
OptimizationCriterion=0
Visual=0
[TesterInputs]
; === Management Control ===
InpInstanceID=PME2
InpManageAllPositions=true||false||0||true||N
InpMagicFilter=0||0||1||10||N
InpDefaultMode=3||0||0||4||N
InpStartLevel=1||0||0||3||N
; === Entry Mode (Backtesting) ===
InpEnableEntries=true||false||0||true||N
InpEntryMagic=77777||77777||1||777770||N
InpEntryRiskPercent=2.0||1.0||0.100000||10.000000||N
InpEntryLots=0.0||0.0||0.000000||0.000000||N
InpStopLossPoints=300||300||1||3000||N
InpTakeProfitRR=3.0||3.0||0.300000||30.000000||N
InpMinBarsBetweenEntries=10||10||1||100||N
; === Risk Protection ===
InpMaxLossPerTrade=3.0||3.0||0.300000||30.000000||N
InpMaxDailyLoss=10.0||10.0||1.000000||100.000000||N
InpMaxDrawdown=25.0||25.0||2.500000||250.000000||N
InpMaxCorrelation=0.8||0.8||0.080000||8.000000||N
; === Emergency Protection ===
InpApplyEmergencyStops=false||false||0||true||N
InpEmergencySLMultiplier=7||2.5||0.250000||25.000000||N
InpEmergencyTPMultiplier=4.0||4.0||0.400000||40.000000||N
; === Stop Loss Management ===
InpDynamicStops=true||false||0||true||N
InpTightenOnProfit=true||false||0||true||N
InpTightenThreshold=50.0||50.0||5.000000||500.000000||N
InpProtectProfits=true||false||0||true||N
; === Breakeven Settings ===
InpBreakevenEnabled=true||false||0||true||N
InpBreakevenTrigger=30.0||30.0||3.000000||300.000000||N
InpBreakevenOffset=5.0||5.0||0.500000||50.000000||N
InpMultiLevelBE=false||false||0||true||N
; === Trailing Stop ===
InpTrailingMethod=3||0||0||8||N
InpTrailStart=50.0||50.0||5.000000||500.000000||N
InpTrailDistance=30.0||30.0||3.000000||300.000000||N
InpTrailStep=10.0||10.0||1.000000||100.000000||N
InpAdaptiveTrailing=true||false||0||true||N
; === Partial Close ===
InpPartialEnabled=true||false||0||true||N
InpPartialTrigger1=50.0||50.0||5.000000||500.000000||N
InpPartialPercent1=30.0||30.0||3.000000||300.000000||N
InpPartialTrigger2=100.0||100.0||10.000000||1000.000000||N
InpPartialPercent2=25.0||25.0||2.500000||250.000000||N
; === Exit Management ===
InpUseTechnicalExits=true||false||0||true||N
InpTimeBasedExits=false||false||0||true||N
InpMaxBarsInTrade=500||500||1||5000||N
InpReduceRiskOverTime=false||false||0||true||N
; === Time Filters ===
InpUseTimeFilter=false||false||0||true||N
InpStartHour=8||8||1||80||N
InpEndHour=20||20||1||200||N
InpFridayClose=true||false||0||true||N
InpFridayCloseHour=21||21||1||210||N
; === Display Settings ===
InpShowDashboard=true||false||0||true||N
InpDashboardX=20||20||1||200||N
InpDashboardY=50||50||1||500||N
InpUpdateFrequency=2||2||1||20||N
; === System Settings ===
InpLogLevel=3||0||0||5||N
InpSaveReports=true||false||0||true||N
InpEmailAlerts=false||false||0||true||N
InpPushAlerts=false||false||0||true||N
InpSoundAlerts=true||false||0||true||N
; === M5 Bar Counting Mode ===
InpEnableM5Mode=true||false||0||true||N
InpM5Partial1=35.0||35.0||3.500000||350.000000||N
InpM5Partial2=60.0||60.0||6.000000||600.000000||N
InpM5Partial3=100.0||100.0||10.000000||1000.000000||N
InpM5Partial4=150.0||150.0||15.000000||1500.000000||N
InpM5Phase1=60||60||1||600||N
InpM5Phase2=180||180||1||1800||N
InpM5MaxBars=300||300||1||3000||N
InpM5DisasterTrigger=100.0||100.0||10.000000||1000.000000||N
InpM5DisasterDistance=150.0||150.0||15.000000||1500.000000||N
InpBarCountEntry=5||3||0||0||N
; === Graduated Stop-Loss (v2.1) ===
InpUseGraduatedStops=true||false||0||true||N
InpInitialStopATR=3.5||3.5||0.350000||35.000000||N
InpPhase1StopATR=2.5||2.5||0.250000||25.000000||N
InpPhase2StopATR=2.0||2.0||0.200000||20.000000||N
InpMatureStopATR=1.5||1.5||0.150000||15.000000||N
; === Delayed Breakeven (v2.1) ===
InpUseDelayedBreakeven=true||false||0||true||N
InpMinBarsBeforeBE=20||20||1||200||N
InpMinProfitBarsForBE=5||5||1||50||N
InpRequireProfitStability=true||false||0||true||N
; === Delayed Trailing (v2.1) ===
InpUseDelayedTrailing=true||false||0||true||N
InpMinBarsBeforeTrail=40||40||1||400||N
InpTrailMinProfit=60.0||60.0||6.000000||600.000000||N
; === Reversal Speed Tracking (v2.1) ===
InpShowReversalMetrics=true||false||0||true||N
InpAdjustForReversalSpeed=true||false||0||true||N
InpFastReversalBars=12||12||1||120||N
InpSlowReversalBars=60||60||1||600||N