mql5/Experts/Advisors/ERMT_PMEx/README_Chapter5_Configuration.md

17 KiB

Chapter 5: Configuration Guide

Complete Parameter Reference

This chapter documents every input parameter in ERMT PME v1.2.


Management Control

InpManageAllPositions

  • Type: bool
  • Default: true
  • Description: Whether PME should manage all positions or only specific ones
  • Recommendation: Keep true unless using Magic Filter

InpMagicFilter

  • Type: int
  • Default: 0
  • Range: 0-999999
  • Description: Filter positions by Magic Number. 0 = manage all positions
  • Use Case: If you run multiple EAs and want PME to manage only specific ones
  • Example: Set to 12345 to manage only positions with magic 12345

InpDefaultMode

  • Type: ENUM_MANAGEMENT_MODE
  • Default: MODE_BREAKEVEN_TRAIL
  • Options:
    • MODE_NONE: No active management (monitoring only)
    • MODE_BREAKEVEN_ONLY: Only apply breakeven
    • MODE_BREAKEVEN_TRAIL: Breakeven + trailing (recommended)
    • MODE_FULL: All features enabled

InpStartLevel

  • Type: ENUM_MANAGEMENT_LEVEL
  • Default: LEVEL_STANDARD
  • Options:
    • LEVEL_CONSERVATIVE: Wider stops, less frequent partials
    • LEVEL_STANDARD: Balanced approach (recommended)
    • LEVEL_AGGRESSIVE: Tighter stops, frequent partials

Phase Management Settings

InpUsePhaseManagement

  • Type: bool
  • Default: true
  • Description: Enable/disable the phase-based profit protection system
  • Recommendation: Keep enabled for optimal performance

Phase Triggers

InpPhase1Trigger (PROTECTION)

  • Type: double
  • Default: 40.0
  • Range: 20-100 points
  • Description: Profit threshold to enter PROTECTION phase
  • Tuning:
    • Lower (30): Earlier protection, may cut some winners short
    • Higher (50): More breathing room, but less protection
    • Scalping: 20-30 points
    • Swing Trading: 40-60 points
    • Position Trading: 80-100 points

InpPhase2Trigger (ACCUMULATION)

  • Type: double
  • Default: 60.0
  • Range: 40-150 points
  • Must be: > Phase1Trigger
  • Recommendation: 1.5× Phase1Trigger

InpPhase3Trigger (MAXIMIZATION)

  • Type: double
  • Default: 100.0
  • Range: 60-250 points
  • Must be: > Phase2Trigger
  • Recommendation: 1.67× Phase2Trigger

InpPhase4Trigger (RUNNER)

  • Type: double
  • Default: 200.0
  • Range: 100-500 points
  • Must be: > Phase3Trigger
  • Recommendation: 2× Phase3Trigger

InpPhase5Trigger (EXTREME)

  • Type: double
  • Default: 400.0
  • Range: 200-1000 points
  • Must be: > Phase4Trigger
  • Recommendation: 2× Phase4Trigger

Risk Protection

InpMaxLossPerTrade

  • Type: double
  • Default: 3.0
  • Range: 0.1-20.0 (percentage)
  • Description: Maximum loss allowed on any single position
  • Calculation: Balance × (MaxLoss / 100)
  • Example: $10,000 × 0.03 = $300 max loss per trade
  • Recommendations:
    • Conservative: 1-2%
    • Standard: 3-5%
    • Aggressive: 5-10%
    • ⚠️ Never exceed 10% unless you're very experienced

InpMaxDailyLoss

  • Type: double
  • Default: 10.0
  • Range: 0.1-50.0 (percentage)
  • Description: Maximum cumulative loss allowed in one day
  • Action: Closes all positions if breached
  • Recommendations:
    • Conservative: 5-10%
    • Standard: 10-20%
    • Aggressive: 20-30%
    • ⚠️ Essential for preventing "revenge trading" spirals

InpMaxDrawdown

  • Type: double
  • Default: 25.0
  • Range: 0.1-100.0 (percentage)
  • Description: Maximum peak-to-valley decline before emergency shutdown
  • Action: Closes all positions and stops trading
  • Recommendations:
    • Conservative: 15-20%
    • Standard: 20-30%
    • Aggressive: 30-40%
    • ⚠️ This is your "circuit breaker"

InpMaxCorrelation

  • Type: double
  • Default: 0.80
  • Range: 0.0-1.0
  • Description: Maximum correlation allowed between positions
  • Purpose: Prevent over-concentration in related instruments
  • Example: 0.80 means max 80% correlation (e.g., EURUSD and GBPUSD)

Emergency Protection

InpApplyEmergencyStops

  • Type: bool
  • Default: true
  • Description: Automatically add stops to positions without SL
  • Recommendation: Always keep enabled

InpEmergencySLMultiplier

  • Type: double
  • Default: 7.0
  • Range: 1.0-20.0
  • Description: ATR multiplier for emergency stop-loss distance
  • Calculation: SL Distance = ATR × Multiplier
  • Example: ATR = 20 pips, Multiplier = 7 → SL at 140 pips
  • Tuning:
    • Tight (3-5): For scalping or high-confidence entries
    • Standard (7-10): General purpose
    • Wide (10-20): Swing/position trading or volatile instruments

InpEmergencyTPMultiplier

  • Type: double
  • Default: 4.0
  • Range: 1.0-20.0
  • Description: ATR multiplier for emergency take-profit
  • Purpose: Set a reasonable TP if position has none
  • Recommendation: 0.5× to 0.75× of SL multiplier

Dynamic Stop Management

InpDynamicStops

  • Type: bool
  • Default: true
  • Description: Enable dynamic adjustment of stops based on profit
  • Features:
    • Tightens stops as profit grows
    • Widens stops in strong momentum
    • Adapts to volatility changes

InpTightenOnProfit

  • Type: bool
  • Default: true
  • Description: Automatically tighten stops when profit threshold reached
  • Works with: InpTightenThreshold

InpTightenThreshold

  • Type: double
  • Default: 75.0
  • Range: 30-200 points
  • Description: Profit level at which to begin tightening stops
  • Recommendation: Between Phase2 and Phase3 triggers

InpProtectProfits

  • Type: bool
  • Default: true
  • Description: Enable profit protection mechanisms
  • Features:
    • Prevents SL from moving backward
    • Maintains minimum locked profit
    • Enforces progressive locking

InpProtectionThreshold

  • Type: double
  • Default: 100.0
  • Range: 50-300 points
  • Description: Profit level where maximum protection activates
  • Recommendation: Same as Phase3Trigger

Breakeven Settings

InpBreakevenEnabled

  • Type: bool
  • Default: false (DISABLED in v1.2)
  • Description: Enable traditional breakeven system
  • ⚠️ Note: Disabled by default because phase locks provide superior protection
  • Conflict: If both breakeven and phase management are enabled, phase management takes precedence

InpBreakevenTrigger

  • Type: double
  • Default: 40.0
  • Range: 10-100 points
  • Description: Profit at which to move SL to breakeven
  • Ignored if: InpUsePhaseManagement = true

InpBreakevenOffset

  • Type: double
  • Default: 8.0
  • Range: 0-50 points
  • Description: Points above entry to set SL (spread + small profit)
  • Example: Entry 1.0850, Offset 8pts → SL at 1.0858

InpMultiLevelBE

  • Type: bool
  • Default: false
  • Description: Enable multiple breakeven levels
  • Purpose: Progressive breakeven at different profit milestones

Trailing Stop Settings

InpTrailingMethod

  • Type: ENUM_TRAILING_METHOD
  • Default: TRAIL_ATR
  • Options:
    • TRAIL_NONE: No trailing
    • TRAIL_FIXED: Fixed point distance
    • TRAIL_ATR: ATR-based (recommended)
    • TRAIL_PARABOLIC: Parabolic SAR-based
    • TRAIL_ADAPTIVE: Combines multiple methods

InpTrailStart

  • Type: double
  • Default: 60.0
  • Range: 20-200 points
  • Description: Profit at which trailing starts
  • Recommendation: Same as Phase2Trigger

InpTrailDistance

  • Type: double
  • Default: 40.0
  • Range: 5-200 points
  • Description: Distance from current price to trail (if TRAIL_FIXED)
  • Recommendation: Use TRAIL_ATR instead for dynamic distance

InpTrailStep

  • Type: double
  • Default: 15.0
  • Range: 1-100 points
  • Description: Minimum price movement before adjusting trailing stop
  • Purpose: Reduce broker requests and avoid whipsaws
  • Tuning:
    • Small (5-10): Tight tracking, more updates
    • Medium (15-20): Balanced
    • Large (30-50): Loose tracking, fewer updates

InpAdaptiveTrailing

  • Type: bool
  • Default: true
  • Description: Adjust trailing distance based on volatility and momentum
  • Recommendation: Keep enabled

Volatility Multipliers

InpLowVolatilityMultiplier

  • Type: double
  • Default: 0.8
  • Description: Trail distance multiplier in low volatility
  • Effect: Tighter trails when market is calm

InpHighVolatilityMultiplier

  • Type: double
  • Default: 1.5
  • Description: Trail distance multiplier in high volatility
  • Effect: Wider trails to avoid whipsaws

InpVolatilityThreshold

  • Type: double
  • Default: 1.2
  • Description: ATR threshold to classify as "high volatility"
  • Calculation: Current ATR / Average ATR > Threshold = High Volatility

Partial Close Strategy

InpPartialEnabled

  • Type: bool
  • Default: true
  • Description: Enable multi-level partial closures
  • Recommendation: Keep enabled for profit banking

InpPartialLevels

  • Type: int
  • Default: 4
  • Range: 1-10
  • Description: Number of partial closure levels
  • Standard: 4 levels (50/100/200/400 points)

Partial Level Configuration

Each level has two parameters: Trigger (profit points) and Percent (close %).

Level 1

  • InpPartialTrigger1: 50.0 points
  • InpPartialPercent1: 20.0%
  • Purpose: Bank first profits, reduce risk

Level 2

  • InpPartialTrigger2: 100.0 points
  • InpPartialPercent2: 20.0%
  • Purpose: Continue profit banking

Level 3

  • InpPartialTrigger3: 200.0 points
  • InpPartialPercent3: 25.0%
  • Purpose: Secure majority of profit

Level 4

  • InpPartialTrigger4: 400.0 points
  • InpPartialPercent4: 20.0%
  • Purpose: Final banking, keep small runner

InpRunnerPercentage

  • Type: double
  • Default: 15.0
  • Range: 5-50 (percentage)
  • Description: Minimum position size to keep as final runner
  • Example: 15% means at least 15% of original size remains

InpRunnerTrailMultiplier

  • Type: double
  • Default: 2.0
  • Range: 1.0-5.0
  • Description: Wider trail multiplier for runner portion
  • Purpose: Give runner more room to capture extended moves

InpRunnerExitThreshold

  • Type: double
  • Default: 500.0
  • Range: 200-2000 points
  • Description: Extreme profit level to consider closing runner
  • Purpose: Exit on exhaustion signals at extreme profits

Exit Management

InpUseTechnicalExits

  • Type: bool
  • Default: false
  • Description: Close positions on technical reversal signals
  • Signals: RSI extremes, MACD crossovers, trend breaks

InpTimeBasedExits

  • Type: bool
  • Default: false
  • Description: Close positions after maximum time in trade
  • Purpose: Exit stale positions

InpMaxBarsInTrade

  • Type: int
  • Default: 1000
  • Range: 50-10000 bars
  • Description: Maximum bars a position can remain open
  • Calculation: Based on chart timeframe

InpReduceRiskOverTime

  • Type: bool
  • Default: false
  • Description: Gradually tighten stops as time passes
  • Purpose: Encourage quicker profit-taking

Phase Lock Settings

InpUsePhaseProfitLocks

  • Type: bool
  • Default: true
  • Description: Enable phase-based progressive profit locking
  • Recommendation: Always keep enabled

InpPhaseLockBreathingRoom

  • Type: double
  • Default: 50.0
  • Range: 0-100 (percentage)
  • Description: Retracement allowed from peak before SL hits
  • Example: 50% means position can lose half of unrealized profit

InpMaintainLockOnRetreat

  • Type: bool
  • Default: true
  • Description: Keep highest phase lock when retreating to lower phase
  • Recommendation: Always keep enabled (retreat protection)

InpRetreatLockMultiplier

  • Type: double
  • Default: 1.2
  • Range: 1.0-2.0
  • Description: Tighten lock by this factor when retreating
  • Example: 1.2 = 20% tighter lock on retreat

Phase Minimum Locks

InpPhase1MinLock

  • Default: 10.0 points (PROTECTION phase)

InpPhase2MinLock

  • Default: 25.0 points (ACCUMULATION phase)

InpPhase3MinLock

  • Default: 50.0 points (MAXIMIZATION phase)

InpPhase4MinLock

  • Default: 100.0 points (RUNNER phase)

InpPhase5MinLock

  • Default: 200.0 points (EXTREME phase)

Purpose: Safety floor - SL never goes below these levels for each phase


Time Filters

InpUseTimeFilter

  • Type: bool
  • Default: false
  • Description: Only manage positions during specific hours

InpStartHour

  • Type: int
  • Default: 0
  • Range: 0-23
  • Description: Hour to start management (broker time)

InpEndHour

  • Type: int
  • Default: 24
  • Range: 0-24
  • Description: Hour to stop management (broker time)

InpFridayClose

  • Type: bool
  • Default: false
  • Description: Close all positions on Friday before weekend

InpFridayCloseHour

  • Type: int
  • Default: 23
  • Range: 0-23
  • Description: Hour on Friday to close positions

Session Management

InpSessionBasedManagement

  • Type: bool
  • Default: true
  • Description: Adjust management based on trading session
  • Sessions: Asian, London, New York

Asian Session

InpAsianTrailMultiplier

  • Default: 1.2 (wider)
  • Rationale: Lower volatility, avoid whipsaws

InpAsianPartialMultiplier

  • Default: 1.5 (less frequent)
  • Rationale: Slower profit-taking in ranging markets

London Session

InpLondonTrailMultiplier

  • Default: 1.0 (standard)

InpLondonPartialMultiplier

  • Default: 1.0 (standard)

New York Session

InpNewYorkTrailMultiplier

  • Default: 0.9 (tighter)
  • Rationale: High volatility, capture momentum

InpNewYorkPartialMultiplier

  • Default: 0.8 (more frequent)
  • Rationale: Bank profits quickly during volatile moves

Advanced Settings

InpUseVolumeAnalysis

  • Type: bool
  • Default: true
  • Description: Consider volume when making exit decisions

InpHighVolumeThreshold

  • Type: double
  • Default: 1.5
  • Description: Relative volume threshold for "high volume"

InpExtendTargetsOnMomentum

  • Type: bool
  • Default: true
  • Description: Keep positions longer in strong momentum

InpMomentumThreshold

  • Type: double
  • Default: 2.0
  • Description: ATR-based momentum threshold

InpUseSmartExits

  • Type: bool
  • Default: true
  • Description: Avoid closing at support/resistance

InpMinProfitForExit

  • Type: double
  • Default: 30.0
  • Description: Minimum profit before technical exit signals apply

InpCheckSupportResistance

  • Type: bool
  • Default: true
  • Description: Check S/R levels before exiting

InpSRBuffer

  • Type: double
  • Default: 10.0
  • Description: Points around S/R to avoid closing

Display Settings

InpShowDashboard

  • Type: bool
  • Default: true
  • Description: Display on-chart dashboard

InpDashboardX

  • Type: int
  • Default: 20
  • Description: Dashboard X position (pixels from left)

InpDashboardY

  • Type: int
  • Default: 50
  • Description: Dashboard Y position (pixels from top)

InpUpdateFrequency

  • Type: int
  • Default: 2
  • Range: 1-60 seconds
  • Description: Dashboard update interval

System Settings

InpLogLevel

  • Type: ENUM_LOG_LEVEL
  • Default: LOG_INFO
  • Options:
    • LOG_NONE: No logging
    • LOG_ERROR: Errors only
    • LOG_WARNING: Errors + warnings
    • LOG_INFO: Normal operation (recommended)
    • LOG_DEBUG: Detailed debugging

InpSaveReports

  • Type: bool
  • Default: true
  • Description: Save periodic snapshots and final reports

InpEmailAlerts

  • Type: bool
  • Default: false
  • Description: Send email alerts on critical events
  • Requires: MT5 email configuration

InpPushAlerts

  • Type: bool
  • Default: false
  • Description: Send push notifications to mobile
  • Requires: MT5 push notification setup

InpSoundAlerts

  • Type: bool
  • Default: true
  • Description: Play sound alerts

Preset Configurations

Conservative

Max Loss Per Trade: 2%
Max Daily Loss: 10%
Phase 1 Trigger: 50 pts
Breakeven: Enabled at 40 pts
Trailing: Wide (50 pts)
Partial Close: Aggressive (more frequent)
Max Loss Per Trade: 5%
Max Daily Loss: 20%
Phase 1 Trigger: 40 pts
Breakeven: Disabled (use phase locks)
Trailing: ATR-based adaptive
Partial Close: Standard 4 levels

Aggressive

Max Loss Per Trade: 8%
Max Daily Loss: 30%
Phase 1 Trigger: 30 pts
Breakeven: Disabled
Trailing: Tight (25 pts)
Partial Close: Less frequent (larger partials)

Return to: Main README