# User Guide โ€” Input Parameters > **System overview:** This trading system uses two Expert Advisors that work together. The **Master EA** runs on your prop firm funded account: it generates signals, manages positions, and orchestrates the risk. The **Slave EA** runs on a separate personal account: it automatically opens inverse hedge positions to cover potential drawdowns on the funded account. They communicate via CSV files placed in the MetaTrader shared folder. --- ## Table of Contents 1. [Master EA](#master-ea) - [Main Configuration](#-main-configuration) - [Trading Profiles](#-trading-profiles) - [VuManChu Indicator](#-vumanchu-indicator) - [Smart Money Concepts](#-smart-money-concepts) - [Market Structure](#-market-structure) - [Order Blocks](#-order-blocks) - [Pattern Recognition](#-pattern-recognition) - [Volume Analysis](#-volume-analysis) - [Session & Timing](#-session--timing) - [Risk Management](#-risk-management) - [Anti-Multi-Open Guard](#-anti-multi-open-guard) - [Position Management](#-position-management) - [Advanced Filters](#-advanced-filters) - [Genetic Optimization Weights](#-genetic-optimization-weights) - [Scoring Thresholds](#-scoring-thresholds) - [ML Signal Filter](#-ml-signal-filter) - [ML Entry Optimizer (Warm-Up)](#-ml-entry-optimizer-warm-up) - [Smart Entry Optimizer](#-smart-entry-optimizer) - [Smart Lot Sizing ML](#-smart-lot-sizing-ml) - [Trade Exit Optimizer ML](#-trade-exit-optimizer-ml) - [Drawdown Predictor ML](#-drawdown-predictor-ml) - [Session Performance Tracker](#-session-performance-tracker) - [Regime Detection ML](#-regime-detection-ml) - [Dynamic Correlation](#-dynamic-correlation) - [Multi-Timeframe Confluence](#-multi-timeframe-confluence) - [Typed Confluence System](#-typed-confluence-system) - [ICT Best Practices](#-ict-best-practices) - [Slave Communication](#-slave-communication) - [Communication Files](#-communication-files) - [Trade Journal](#-trade-journal) - [Performance Tracking](#-performance-tracking) - [Logging](#-logging) - [Test Mode](#-test-mode) 2. [Slave EA](#slave-ea) - [Main Configuration](#-main-configuration-1) - [Recovery Profiles](#-recovery-profiles) - [Machine Learning](#-machine-learning) - [Adaptive Recovery Ratio ML](#-adaptive-recovery-ratio-ml) - [Advanced Risk Management](#-advanced-risk-management) - [Communication](#-communication) - [Orphan Protection](#-orphan-protection) - [Strict Risk Management](#-strict-risk-management) - [Performance Tracking](#-performance-tracking-1) - [Debug & Test](#-debug--test) 3. [Recommended Configurations by Use Case](#recommended-configurations-by-use-case) --- # Master EA The Master EA is the brain of the system. It analyzes the market, generates trading signals based on VuManChu momentum, Smart Money Concepts, and machine learning, then waits for the Slave EA to confirm a hedge position before opening a trade. --- ## ๐Ÿ† Main Configuration These are the fundamental parameters that define how the EA identifies itself and on which timeframes it operates. | Parameter | Default | Description | |-----------|---------|-------------| | `SignalTF` | M15 | The timeframe on which signals are generated. The EA opens a new bar on this TF to check for a trading opportunity. | | `HigherTF` | H1 | Higher timeframe used for confirmation of trend direction and SMC context. Must be higher than `SignalTF`. | | `MagicNumber` | 123000 | Unique identifier for this EA's positions. **Must match the `MagicBase` set on the Slave EA.** Do not change unless you are running multiple independent instances. | **Notes:** - `SignalTF = M15` + `HigherTF = H1` is the recommended combination for most prop firm challenges. - If you change `MagicNumber`, update it on the Slave EA too, otherwise the hedge system will not recognize the positions. --- ## ๐Ÿ“Š Trading Profiles The profile determines which set of scoring thresholds and risk settings are applied. It is the quickest way to adjust the EA's overall behavior. | Profile | Use Case | Behavior | |---------|----------|----------| | `PROFILE_CHALLENGE_PHASE1` | Phase 1 prop firm challenge | Ultra conservative โ€” only the highest-quality signals pass (score โ‰ฅ 42). Minimizes risk of failing the challenge. | | `PROFILE_CHALLENGE_PHASE2` | Phase 2 / verification | Conservative โ€” slightly relaxed (score โ‰ฅ 35). Good balance between safety and reaching the profit target. | | `PROFILE_FUNDED_ACCOUNT` | Funded live account | Balanced โ€” targets 5-7% monthly return with controlled drawdown (score โ‰ฅ 32). | | `PROFILE_PERSONAL_ACCOUNT` | Personal/non-prop account | Aggressive โ€” more trade opportunities, higher risk tolerance (score โ‰ฅ 25). | | `PROFILE_CUSTOM` | Advanced users | Uses the manual scoring thresholds defined in the **Scoring Thresholds** section below. | **Recommendation:** Start with `PROFILE_CHALLENGE_PHASE1` for any new prop firm attempt. Switch to `PROFILE_FUNDED_ACCOUNT` once the account is funded. --- ## ๐Ÿ“ˆ VuManChu Indicator The VuManChu WaveTrend oscillator is the primary momentum indicator. It detects overbought/oversold conditions and divergences. The indicator file (`Indicator_v8`) is hardcoded and must be placed in your `MQL5/Indicators/` folder. | Parameter | Default | Description | |-----------|---------|-------------| | `WaveTrendLength` | 9 | Period of the WaveTrend calculation. Lower = faster, more sensitive. Higher = smoother, fewer signals. | | `WaveTrendMA` | 12 | Moving average applied to the WaveTrend. Smooths out noise. | | `WaveTrendChannelLen` | 3 | Channel width for the oscillator. Controls how wide the signal bands are. | | `OverboughtLevel1` | 50 | First overbought threshold. Signals above this level are considered extended. | | `OverboughtLevel2` | 70 | Extreme overbought threshold. Reversal signals at this level are high priority. | | `OversoldLevel1` | -50 | First oversold threshold. | | `OversoldLevel2` | -70 | Extreme oversold threshold. Reversal signals here are high priority. | | `DivergenceLookback` | 50 | Number of bars to look back when scanning for price/oscillator divergences. | **Notes:** - Default values are tuned for M15 on major pairs. Do not change these unless you have backtested the effect. - Divergences between price and WaveTrend are one of the most reliable signals in the system. --- ## ๐ŸŽฏ Smart Money Concepts These toggles control which Smart Money Concepts (SMC) analysis layers are active. Each one adds a layer of confluence validation. | Parameter | Default | Description | |-----------|---------|-------------| | `UseMarketStructureSMC` | true | Analyze market structure (Break of Structure / Change of Character). Required for most SMC signals. | | `UseOrderBlocks` | true | Detect institutional order blocks (zones where large players placed orders). | | `UseSupplyDemand` | true | Identify supply (resistance) and demand (support) zones. | | `UseImbalance` | true | Detect Fair Value Gaps (FVG) โ€” price imbalances that tend to get filled. | | `UseLiquidityVoids` | true | Find areas where price moved quickly with no traded volume (liquidity voids). | | `UseVolumeProfile` | true | Incorporate volume profile analysis to confirm key price levels. | **Recommendation:** Keep all enabled. Disabling any of these reduces the quality of the SMC confluence score, which is the most heavily weighted factor in the system (35% by default). --- ## ๐Ÿ“ Market Structure Fine-tuning parameters for the market structure detection engine. | Parameter | Default | Description | |-----------|---------|-------------| | `StructureLookback` | 50 | Bars to look back when mapping swing highs/lows for market structure. | | `SwingStrength` | 2 | Minimum number of bars on each side to confirm a swing point. Increase to filter out minor swings. | | `DetectBOS` | true | Detect Break of Structure (BOS) โ€” continuation signal when structure is broken in trend direction. | | `DetectCHOCH` | true | Detect Change of Character (CHoCH) โ€” early reversal signal. | | `MinSwingPoints` | 5 | Minimum number of valid swing points required before the structure is considered reliable. | --- ## ๐Ÿงฑ Order Blocks Parameters controlling how institutional order blocks are identified. | Parameter | Default | Description | |-----------|---------|-------------| | `OrderBlockLookback` | 50 | How many bars back to scan for valid order blocks. | | `MinOrderBlockSize` | 0.5 | Minimum size of a candle (as ATR multiplier) to qualify as an order block. Filters out small, weak zones. | | `UseVolumeValidation` | true | Require a volume spike to validate an order block. Increases reliability. | | `MinVolumeIncrease` | 1.2 | Volume must be at least this multiple of average volume for the order block to be validated (1.2 = 20% above average). | --- ## ๐Ÿ•ฏ Pattern Recognition Controls detection of classic candlestick reversal patterns, used as an additional confluence factor. | Parameter | Default | Description | |-----------|---------|-------------| | `UseEngulfing` | true | Detect bullish/bearish engulfing candles. | | `UsePinBar` | true | Detect pin bars (hammer/shooting star) โ€” strong rejection of a price level. | | `UseInsideBar` | true | Detect inside bars โ€” consolidation before a breakout. | | `UseFakeout` | true | Detect fakeout patterns โ€” false breaks that quickly reverse. | | `PatternWeight` | 15.0 | Contribution of pattern signals to the global score (%). | --- ## ๐Ÿ“Š Volume Analysis Volume is used to confirm signal strength. Low volume signals are treated with skepticism. | Parameter | Default | Description | |-----------|---------|-------------| | `UseVolumeFilter` | true | Require minimum volume before generating a signal. | | `MinVolume` | 1000 | Minimum tick volume for a signal to be valid. Filters out signals during illiquid periods. | | `VolumeIncreaseRatio` | 1.5 | Volume must be at least this multiple of the average to confirm a strong move (1.5 = 50% above average). | | `VolumeWeight` | 20.0 | Contribution of volume analysis to the global score (%). | --- ## โฐ Session & Timing Controls which trading sessions are active. Trading outside liquid sessions significantly increases spread costs and reduces signal reliability. | Parameter | Default | Description | |-----------|---------|-------------| | `UseSessionFilter` | true | Enable session filtering. When enabled, only trades during active sessions. | | `TradeLondonSession` | true | Allow trading during London session (08:00โ€“17:00 GMT). The most liquid session for EUR, GBP pairs. | | `TradeNewYorkSession` | true | Allow trading during New York session (13:00โ€“22:00 GMT). Best for USD pairs. | | `TradeAsianSession` | false | Allow trading during Asian session (00:00โ€“09:00 GMT). Lower volatility โ€” disabled by default. | | `AvoidSessionOverlap` | false | If enabled, pauses trading during the London/New York overlap (13:00โ€“17:00 GMT), a very volatile period. | | `TimingWeight` | 10.0 | Contribution of session/timing analysis to the global score (%). | **Note:** For backtesting, set `UseSessionFilter = true` and enable all three sessions to get an unbiased dataset. For live trading, keep Asian sessions off unless you specifically trade JPY pairs. --- ## ๐Ÿ’ฐ Risk Management Core position-sizing and drawdown protection parameters. | Parameter | Default | Description | |-----------|---------|-------------| | `RiskPercent` | 0.5 | Percentage of account balance risked per trade (based on SL distance). 0.5% is very conservative โ€” ideal for prop firm challenges. | | `MaxDailyLossPercent` | 2.0 | If the account loses this % in a single day, trading stops until the next day. | | `MaxTotalDrawdown` | 10.0 | If total drawdown reaches this %, trading is halted completely. Set this below your prop firm's limit. | | `MaxOpenPositions` | 3 | Maximum number of concurrent open positions. | | `UseDynamicLot` | true | When enabled, lot size is calculated automatically based on `RiskPercent` and SL distance. Recommended: always keep enabled. | | `FixedLotSize` | 0.1 | Lot size used if `UseDynamicLot` is disabled. Ignored when dynamic sizing is on. | | `PreventOppositeDirections` | true | Prevents opening a BUY if a SELL is already open on the same pair, and vice versa. | **Warning:** For prop firm challenges, never set `RiskPercent` above 1.0. Typical prop firms allow 5% max daily loss โ€” stay well below that. --- ## ๐Ÿ›ก๏ธ Anti-Multi-Open Guard Prevents the EA from opening multiple positions in rapid succession (e.g., on every tick during a volatile moment). | Parameter | Default | Description | |-----------|---------|-------------| | `UseTradeOpenCooldown` | true | Enable a mandatory waiting period between two consecutive trade openings. | | `TradeOpenCooldownSeconds` | 60 | Minimum time (in seconds) between opening two trades. | | `UseSignalBarGuard` | true | Only allow one trade opening per bar. Prevents spam-opening on the same signal candle. | | `PreventSameDirectionStacking` | true | Prevents opening multiple trades in the same direction on the same pair. | **Recommendation:** Keep all enabled. These guards are essential for avoiding overtrading. --- ## ๐ŸŽฏ Position Management Controls what happens after a trade is opened: breakeven, partial closes, and trailing stop. | Parameter | Default | Description | |-----------|---------|-------------| | `UseBreakeven` | true | Automatically moves SL to entry price once the trade reaches the trigger level. | | `BreakevenTrigger` | 1.0 | R:R ratio at which the breakeven move is triggered (1.0 = once profit equals initial risk). | | `BreakevenOffset` | 0.1 | The SL is moved to entry + this offset (in R:R). Locks in a small profit above breakeven. | | `UsePartialClose` | true | Automatically close a portion of the position at the first target. | | `PartialClosePercent` | 50 | Percentage of the position closed at the partial target (50 = close half). | | `PartialCloseTarget` | 1.0 | R:R ratio at which the partial close is executed. | | `UseTrailingStop` | false | Enable trailing stop on remaining position after partial close. Disabled by default (more conservative). | | `TrailingStart` | 2.0 | R:R level at which the trailing stop activates. | | `TrailingStep` | 0.5 | How closely the trailing stop follows price (in R:R increments). | --- ## ๐Ÿ” Advanced Filters Additional filters to avoid entering trades in unfavorable conditions. | Parameter | Default | Description | |-----------|---------|-------------| | `UseATRFilter` | true | Require minimum volatility (ATR) before trading. Avoids signals during flat/dead markets. | | `MinATRValue` | 0.0010 | Minimum ATR value (in price units). For EURUSD on M15, 0.0010 = 10 pips. | | `UseSpreadFilter` | false | Block trades if the current spread exceeds `MaxSpreadPoints`. Disabled by default. | | `MaxSpreadPoints` | 50 | Maximum allowed spread in points (50 points = 5 pips for a 5-decimal broker). | | `UseCorrelationFilter` | true | Block a new trade if a highly correlated pair already has an open position. | | `MaxCorrelation` | 0.7 | Correlation coefficient above which two pairs are considered dangerously correlated (0 = no correlation, 1 = perfect correlation). | | `UseNewsFilter` | true | Suspend trading around high-impact news events. | | `NewsBeforeMinutes` | 30 | Stop trading this many minutes before a news event. | | `NewsAfterMinutes` | 30 | Resume trading this many minutes after a news event. | --- ## ๐Ÿงฌ Genetic Optimization Weights These five weights control how much each analysis component contributes to the final signal score (total must ideally sum to ~100). | Parameter | Default | Description | |-----------|---------|-------------| | `Wt_VuManChu` | 30.0 | Weight for VuManChu momentum/divergence signals. | | `Wt_SMC` | 35.0 | Weight for Smart Money Concepts (Order Blocks, Structure). The most reliable component. | | `Wt_Volume` | 15.0 | Weight for volume confirmation. | | `Wt_Pattern` | 12.0 | Weight for candlestick pattern recognition. | | `Wt_Timing` | 8.0 | Weight for session and timing factors. | **Note:** The default distribution (30/35/15/12/8) was determined through genetic optimization on historical data. Changes should be based on backtesting results โ€” not intuition. --- ## ๐Ÿ’ฏ Scoring Thresholds Each trading profile uses a minimum score threshold. If `TradingProfile = PROFILE_CUSTOM`, these values are used directly. | Parameter | Default | Profile Linked | |-----------|---------|----------------| | `MinScoreChallenge1` | 42 | `PROFILE_CHALLENGE_PHASE1` | | `MinScoreChallenge2` | 35 | `PROFILE_CHALLENGE_PHASE2` | | `MinScoreFunded` | 32 | `PROFILE_FUNDED_ACCOUNT` | | `MinScorePersonal` | 25 | `PROFILE_PERSONAL_ACCOUNT` | | `MinConfluences` | 2 | Minimum typed confluences for `PROFILE_CUSTOM` mode | | `UseAdaptiveScoring` | true | Dynamically adjusts score thresholds based on recent performance and market regime. | **Important:** A signal must score above the threshold AND meet the confluence requirements. Lowering these values increases trade frequency but reduces quality. --- ## ๐Ÿค– ML Signal Filter A neural network trained on past trades that assigns a confidence score to each signal before it is executed. | Parameter | Default | Description | |-----------|---------|-------------| | `UseMLSignalFilter` | true | Enable the ML filter. When disabled, all valid signals pass without ML validation. | | `MLMinConfidence` | 0.5 | Minimum ML confidence required to execute a trade (0.0โ€“1.0). Increase for fewer, higher-confidence trades. | | `MLBoostThreshold` | 0.80 | Above this confidence, the signal score is boosted. High-confidence signals can override a borderline score. | | `MLRejectThreshold` | 0.35 | Below this confidence, the signal is rejected regardless of its score. | | `UseMLAdaptiveLearning` | true | The ML model continues to learn from new trades during live operation. | | `MLModelFile` | master_ml_brain.bin | File where the ML model is saved and loaded. Keep the default unless running multiple instances. | | `MLFeatureCount` | 20 | Number of market features fed to the neural network. Do not change. | | `MLHiddenNeurons` | 12 | Size of the hidden layer in the neural network. Do not change. | | `MLLearningRate` | 0.05 | How fast the model adapts to new data. Higher = faster adaptation but less stable. | --- ## ๐Ÿ”ง ML Entry Optimizer (Warm-Up) During the initial learning phase, the ML filter runs with relaxed thresholds so it can gather data before becoming stricter. | Parameter | Default | Description | |-----------|---------|-------------| | `UseMLWarmUp` | true | Enable the warm-up phase. The ML model filters less aggressively during this period. | | `MLWarmUpTrades` | 20 | Number of completed trades before the full ML filter becomes active. | | `MLWarmUpMinConfidence` | 0.40 | Reduced confidence threshold during warm-up (vs. `MLMinConfidence = 0.5` in normal mode). | --- ## ๐ŸŽฏ Smart Entry Optimizer Instead of entering at market price, this module attempts to get a better fill price using limit orders or waiting for a Fibonacci retracement. | Parameter | Default | Description | |-----------|---------|-------------| | `UseSmartEntry` | true | Enable entry optimization. When disabled, all trades enter at current market price. | | `UseLimitOrders` | true | Place a limit order at a better price instead of entering immediately at market. | | `MaxWaitATR` | 0.5 | How far from current price (in ATR) the limit order is placed. | | `LimitOrderExpiryBars` | 3 | If the limit order is not filled within this many bars, it is cancelled. | | `UseScaledEntry` | true | Split the entry into multiple smaller orders at different price levels. | | `ScaledEntryParts` | 2 | Number of entry parts (2 = split into two equal halves). | | `ScaledEntrySpread` | 0.3 | Distance between each entry part (in ATR). | | `UseRetracementEntry` | true | Wait for a Fibonacci retracement before entering. Improves average entry price. | | `RetracementLevel` | 0.382 | Target retracement level (0.236, 0.382, or 0.5 are classical ICT/Fibonacci levels). | | `RetracementTimeoutBars` | 5 | If the retracement is not reached within this many bars, enter at market. | | `UseOptimizeSLTP` | true | Adjust SL/TP to align with nearby key levels (Order Blocks, FVGs). | | `MinSLPips` | 15.0 | Minimum SL distance in pips. Prevents overly tight stops that get hit by normal noise. | | `MinRiskReward` | 2.0 | Minimum R:R ratio required for a trade to be executed. | | `TargetRiskReward` | 3.0 | Ideal R:R ratio โ€” the system tries to optimize the TP to reach this. | | `MaxLotAbsolute` | 5.0 | Hard cap on lot size regardless of risk calculation. Safety net. | --- ## ๐ŸŽฒ Smart Lot Sizing ML Adjusts the lot size dynamically based on ML confidence, market volatility, and session performance. | Parameter | Default | Description | |-----------|---------|-------------| | `UseSmartLotSizing` | true | Enable dynamic lot sizing. | | `LotSizingMLWeight` | 0.5 | How much the ML confidence influences lot size (0.0 = ignore ML, 1.0 = fully driven by ML). | | `MinLotMultiplier` | 0.5 | Minimum lot multiplier โ€” lots will never be reduced below 50% of the base calculation. | | `MaxLotMultiplier` | 1.5 | Maximum lot multiplier โ€” lots will never exceed 150% of the base calculation. | | `UseSessionLotBoost` | true | Slightly increase lot size during historically profitable sessions. | | `SessionBoostMultiplier` | 1.2 | Multiplier applied during good sessions (+20%). | | `LowVolatilityMultiplier` | 0.7 | Reduce lots during low-volatility periods (โˆ’30%). | | `HighVolatilityMultiplier` | 1.3 | Increase lots slightly during high-volatility periods (+30%). | --- ## ๐Ÿšช Trade Exit Optimizer ML Manages active positions dynamically, looking for early partial close or full exit opportunities before TP is reached. | Parameter | Default | Description | |-----------|---------|-------------| | `UseExitOptimizer` | true | Enable dynamic exit management. | | `ExitCheckInterval` | 30 | How often (in seconds) the exit optimizer evaluates open positions. | | `MinProfitForPartial` | 0.5 | Minimum profit in R:R before a partial close is considered. | | `MaxUnrealizedProfit` | 2.5 | If a trade reaches this R:R profit without closing, the optimizer forces a review. | | `UseReversalDetection` | true | Exit early if a reversal signal is detected while the trade is in profit. | | `ReversalSensitivity` | 0.7 | Sensitivity of the reversal detector (0.5 = lenient, 1.0 = very strict). | | `UseTimeBasedExit` | true | Force a trade review after a maximum number of bars without significant progress. | | `MaxHoldingBars` | 20 | Maximum number of signal-TF bars before a time-based exit review. | | `StagnantExitProfitPercent` | 50 | If a trade is stagnant, close it when it reaches this % of the TP distance. | --- ## ๐Ÿ“‰ Drawdown Predictor ML Proactively detects when market conditions are deteriorating and reduces risk before drawdown occurs. | Parameter | Default | Description | |-----------|---------|-------------| | `UseDrawdownPredictor` | true | Enable predictive drawdown protection. | | `DDWarningLevel` | 70 | Warning threshold (0โ€“100 score). Above this, risk is reduced by 50%. | | `DDPauseLevel` | 90 | Critical threshold. Above this, trading is paused entirely. | | `DDRiskReductionFactor` | 0.5 | Risk multiplier applied when the warning level is reached (0.5 = half normal lot size). | | `DDLookbackPeriod` | 100 | Number of bars used for historical analysis. | | `DDUseVolatilityStress` | true | Factor in abnormal volatility spikes. | | `DDUseSpreadStress` | true | Factor in spread widening (often precedes volatile moves). | | `DDUseLossStreaks` | true | Analyze recent losing streak patterns. | | `DDUseTimePatterns` | true | Identify historical time patterns associated with drawdowns (e.g., rollover, specific days). | | `DDUpdateIntervalSeconds` | 60 | How often the predictor recalculates its risk score. | --- ## ๐Ÿ“… Session Performance Tracker Tracks win rate and profit factor per session (London, New York, Asian) and adjusts behavior accordingly. | Parameter | Default | Description | |-----------|---------|-------------| | `UseSessionPerformanceTracker` | true | Enable session-based performance analysis. | | `AutoAdjustBySession` | true | Automatically adjust score thresholds and lot sizes based on session history. | | `SessionHistoryDays` | 30 | Number of calendar days of history used to evaluate session performance. | | `MinSessionWinRate` | 0.45 | Minimum win rate for a session. Sessions below this may be disabled. | | `MinSessionProfitFactor` | 1.2 | Minimum profit factor for a session. | | `MinSessionTrades` | 10 | Minimum number of trades in history before a session is evaluated (avoids decisions on small samples). | | `AllowSessionDisable` | true | Allow the EA to automatically disable underperforming sessions. | | `SessionScoreBoostMax` | 1.3 | Maximum score multiplier for historically strong sessions. | | `SessionScoreReductionMax` | 0.7 | Maximum score reduction for historically weak sessions. | | `SessionPerformanceFile` | session_performance.csv | File where session history is stored. | --- ## ๐ŸŒŠ Regime Detection ML Identifies the current market regime (trending, ranging, volatile, quiet) and adapts the strategy accordingly. | Parameter | Default | Description | |-----------|---------|-------------| | `UseRegimeDetection` | true | Enable market regime analysis. | | `AdaptStrategyToRegime` | true | Modify signal thresholds and risk based on detected regime. | | `RegimeATRPeriod` | 14 | ATR period for measuring volatility level. | | `RegimeADXPeriod` | 14 | ADX period for measuring trend strength. | | `RegimeLookback` | 100 | Number of bars used to characterize the current regime. | | `TrendADXThreshold` | 25.0 | ADX above this value = trending market. | | `StrongTrendADXThreshold` | 40.0 | ADX above this = strong trend. The EA increases lot size slightly. | | `VolatileATRMultiplier` | 1.8 | If ATR > average ร— this value, the market is considered volatile. | | `QuietATRMultiplier` | 0.5 | If ATR < average ร— this value, the market is considered too quiet to trade. | | `RangeATRThreshold` | 0.8 | ATR ratio below which a range regime is declared. | | `MinBarsForRegimeChange` | 5 | Minimum consecutive bars in a new regime before switching โ€” prevents false regime flips. | | `UseRegimeForScore` | true | Apply a score modifier based on the current regime. | | `BlockTradingBadRegime` | true | Block all new trades in regimes historically unfavorable for this strategy. | | `RegimeLogFile` | regime_history.csv | File storing the history of detected regimes. | --- ## ๐Ÿ”— Dynamic Correlation Prevents taking correlated positions on multiple pairs simultaneously, limiting total portfolio risk. | Parameter | Default | Description | |-----------|---------|-------------| | `UseDynamicCorrelation` | true | Calculate real-time correlations between all active pairs. | | `CorrelationPeriod` | 100 | Number of bars used for correlation calculation. | | `CorrelationUpdateMinutes` | 15 | How often (in minutes) correlation coefficients are recalculated. | | `HighCorrelationThreshold` | 0.75 | Correlation above this is considered dangerously high. | | `MaxCorrelatedExposure` | 2.0 | Maximum combined risk exposure (%) across correlated pairs. | | `BlockHighCorrelationTrades` | true | Reject new trades on pairs that are currently highly correlated with an existing open position. | | `CorrelationLogFile` | correlations.csv | File storing correlation history for analysis. | --- ## ๐Ÿ“Š Multi-Timeframe Confluence Validates signals across four timeframes simultaneously. A signal is only strong if higher timeframes agree with the entry direction. | Parameter | Default | Description | |-----------|---------|-------------| | `UseMTFConfluence` | true | Enable multi-timeframe validation. | | `MTF_TF1` | M5 | Micro timeframe (entry timing). | | `MTF_TF2` | M15 | Signal timeframe (primary analysis). | | `MTF_TF3` | H1 | Context timeframe (trend direction). | | `MTF_TF4` | H4 | Macro timeframe (macro structure). | | `MTF_WeightTF1` | 0.15 | Weight of TF1 in the multi-TF score. | | `MTF_WeightTF2` | 0.30 | Weight of TF2 in the multi-TF score. | | `MTF_WeightTF3` | 0.35 | Weight of TF3 in the multi-TF score. | | `MTF_WeightTF4` | 0.20 | Weight of TF4 in the multi-TF score. | | `MTF_AlignmentBonus` | 1.25 | Score multiplier when all 4 timeframes agree (ร—1.25 = +25%). | | `MTF_ConflictPenalty` | 0.70 | Score multiplier when timeframes conflict (ร—0.70 = โˆ’30%). | | `MTF_RequireHigherTFAlignment` | true | Require H1 and H4 to agree before any signal is accepted. | | `MTF_TrendLookback` | 20 | Bars used to determine trend direction on each timeframe. | --- ## ๐ŸŽฏ Typed Confluence System Requires that a signal must be confirmed by a minimum number of different confluence *types* (not just quantity). This prevents the EA from counting the same factor multiple times. | Parameter | Default | Description | |-----------|---------|-------------| | `UseTypedConfluences` | true | Enable the typed confluence system (8 distinct confluence categories). | | `MinTypedConfluences` | 3 | Minimum number of *different* confluence types required. Increase to be more selective. | | `RequireSMCConfluence` | true | Mandate that one of the confluences must be of SMC type (Order Block or Structure). | | `LogConfluenceDetails` | false | Log details of each confluence evaluation to the journal. Enable for debugging. | | `ConfluenceScoreWeight` | 0.3 | How much the confluence count adjusts the final score (0 = no influence, 1 = full influence). | --- ## ๐Ÿ›๏ธ ICT Best Practices Applies specific filters based on ICT (Inner Circle Trader) methodology: alignment with higher timeframes, trading during Kill Zones, and requiring multiple ICT concepts before entering. | Parameter | Default | Description | |-----------|---------|-------------| | `UseICTRules` | true | Enable all ICT rules (applies all the filters below). | | `EnforceHTFAlignment` | true | Require that the trade direction aligns with the higher timeframe trend (Rule 1). | | `PreferKillZones` | true | Prioritize signals during ICT Kill Zones: London Open (07:00โ€“09:00 GMT), New York Open (13:00โ€“15:00 GMT) (Rule 2). | | `EnforceICTConfluence` | true | Require the presence of at least Liquidity Sweep + Order Block + FVG before entering (Rule 3). | | `EnforceClarityRule` | true | Reject ambiguous setups โ€” "if it's not clear, it's not there" (Rule 4). | | `UseNewsAvoidance` | true | Avoid trading near high-impact news (Rule 6). | | `NewsAvoidanceMinutes` | 15 | Pause trading this many minutes before/after news. | | `MaxOrderBlockAge` | 20 | Order blocks older than this (in bars) are considered stale and ignored (Rule 7). | | `MaxFVGFillPercent` | 50.0 | FVGs that are already more than 50% filled are ignored โ€” they have lost their significance (Rule 8). | **Note:** For backtesting on historical data, `UseICTRules = false` is recommended to get more trades and a representative sample. For live trading, keep all rules enabled. --- ## ๐Ÿ“ก Slave Communication Controls the handshake protocol between the Master and Slave EAs. **The Master EA will never open a trade without first receiving confirmation from the Slave.** | Parameter | Default | Description | |-----------|---------|-------------| | `UseSlaveCommunication` | true | Enable the Master-Slave protocol. Set to `false` only for solo backtesting where no Slave is used. | | `WaitForSlaveAck` | true | The Master waits for an acknowledgment from the Slave before opening its position. | | `WaitForAckMs` | 30000 | Maximum time to wait for the ACK in milliseconds (30,000 ms = 30 seconds). If no ACK is received, the trade is cancelled. | | `PositionsBroadcastSeconds` | 5 | How often (in seconds) the Master broadcasts its open positions to the Slave via `positions_master.csv`. | | `UseFileCommon` | true | Use MetaTrader's shared `FILE_COMMON` folder. **Both EAs must use the same setting.** | | `CleanCSVFilesOnInit` | true | Delete old communication files when the EA starts. Prevents stale data from previous sessions. | **Warning:** Never disable `WaitForSlaveAck` in live trading. Without it, the Master opens positions without a hedge, defeating the purpose of the system. --- ## ๐Ÿ“ Communication Files File names used for Master-Slave communication. Both EAs must use the exact same file names. | Parameter | Default | Description | |-----------|---------|-------------| | `SignalsFileName` | signals_master.csv | Master writes new trade signals here; Slave reads from it. | | `AckFileName` | signals_ack.csv | Slave writes acknowledgments here after opening the hedge; Master reads from it. | | `ClosuresFileName` | closures_master.csv | Master notifies Slave of closed positions here. | | `PositionsFileName` | positions_master.csv | Master broadcasts all open positions every 5 seconds. Slave uses this for orphan detection. | | `TicketMappingFile` | ticket_mapping.csv | Maps Master ticket numbers to Slave ticket numbers. | | `PerformanceFileName` | master_performance.csv | Performance metrics export file. | **Note:** Do not change these file names unless running multiple independent system instances simultaneously. --- ## ๐Ÿ“” Trade Journal A detailed log of every signal evaluated, including reasons for acceptance or rejection. | Parameter | Default | Description | |-----------|---------|-------------| | `UseTradeJournal` | true | Enable the trade journal. | | `LogAllSignals` | true | Record all signals, including rejected ones. Useful for post-analysis. | | `LogDecisionReasons` | true | Include the reason for acceptance/rejection in each journal entry. | | `CalculateDecisionQuality` | true | Score the quality of each decision based on subsequent outcome. | | `JournalRetentionDays` | 30 | Automatically delete journal entries older than this number of days. | | `ExportJournalCSV` | true | Export a daily CSV summary. | | `TrackRejectedSignals` | true | Keep a separate file for rejected signals to analyze filtering accuracy. | | `JournalFileName` | trade_journal.csv | Main journal file. | | `RejectedSignalsFile` | rejected_signals.csv | Rejected signals archive file. | --- ## ๐Ÿ“Š Performance Tracking Controls the dashboard display and performance data export. | Parameter | Default | Description | |-----------|---------|-------------| | `TrackDetailedStats` | true | Track detailed trade statistics (win rate, profit factor, Sharpe ratio). | | `DisplayDashboard` | true | Show the real-time performance dashboard on the chart. | | `ExportReports` | true | Periodically export performance data to `master_performance.csv`. | | `StatsUpdateSeconds` | 60 | How often (in seconds) the dashboard and stats are refreshed. | --- ## ๐Ÿ“ Logging Controls what appears in the MetaTrader Experts log tab. | Parameter | Default | Description | |-----------|---------|-------------| | `ShowTradingLogs` | true | Log trading events: signals detected, trades opened/closed, P&L. Keep enabled for monitoring. | | `ShowDevLogs` | false | Log detailed technical information: ML internals, indicator values, scoring breakdown. Enable only for debugging โ€” generates a lot of output. | | `LogToFile` | false | Save log output to a text file in addition to the Experts tab. | | `LogFileName` | master_ea_log.txt | Name of the log file (used if `LogToFile = true`). | | `BacktestMode` | false | Signals to the EA that it is running in the strategy tester. **This is automatically detected โ€” do not set manually.** When in backtest mode, the Slave communication is bypassed. | --- ## ๐Ÿงช Test Mode Allows the EA to run in a controlled test mode that forces periodic trades regardless of signal quality. **For development and connectivity testing only โ€” never use in live trading.** | Parameter | Default | Description | |-----------|---------|-------------| | `TestMode` | false | Enable test mode. Forces trades regardless of signal conditions. | | `TestIntervalSeconds` | 30 | Interval at which test trades are placed. | | `TestLotSize` | 0.01 | Fixed lot size for test trades. | | `TestAlternateDirection` | true | Alternate between BUY and SELL on successive test trades. | --- --- # Slave EA The Slave EA runs on a separate personal recovery account. When the Master sends a signal, the Slave opens an inverse position (hedge) to offset potential losses. It also monitors for orphan positions โ€” hedges that remain open when the corresponding Master position has been closed. --- ## ๐Ÿ† Main Configuration | Parameter | Default | Description | |-----------|---------|-------------| | `PairsToMonitor` | *(empty)* | Comma-separated list of pairs to watch (e.g., `EURUSD,GBPUSD`). Leave empty for automatic detection of all pairs traded by the Master. | | `MagicBase` | 123000 | Base magic number. **Must exactly match the `MagicNumber` in the Master EA.** | | `RecoveryTargetAmount` | 250.0 | Dollar amount the Slave account aims to recover. Typically the cost of the prop firm challenge you are covering. This directly drives the Slave's position sizing formula. | | `MonitorAllMasterPairs` | true | Automatically monitor all pairs on which the Master has positions. Recommended โ€” leave enabled. | | `StartingBalanceOverride` | 0 | Manually set the starting balance for the Slave account (used in recovery calculations). Set to `0` to use the actual current account balance automatically. | | `MasterAccountBalance` | 100000 | The funded account balance on the Master side (in dollars). Used to calibrate the risk ratio between Master and Slave. | | `MasterMaxDrawdownPercent` | 5.0 | Maximum drawdown percentage allowed by the prop firm on the Master account. The Slave uses this to size its hedge appropriately. | **Formula:** `Slave Risk per trade = (RecoveryTargetAmount / MasterAccountBalance) ร— MasterMaxDrawdownPercent` Example: $250 target on a $100k account with 5% max DD โ†’ Slave risks ~$50 per trade. --- ## ๐Ÿ’Ž Recovery Profiles Pre-configured profiles that control the overall aggressiveness of the Slave's hedging behavior. | Profile | Description | |---------|-------------| | `PROFILE_CONSERVATIVE` | Small hedge ratios, avoids over-hedging. Best when the Master account has ample margin. | | `PROFILE_BALANCED` | Standard behavior โ€” hedges at a moderate ratio relative to Master lots. | | `PROFILE_AGGRESSIVE` | Larger hedge ratios to recover faster. Use when drawdown recovery is urgent. | | `PROFILE_ADAPTIVE_ML` | *(Recommended)* ML dynamically adjusts the hedge ratio based on drawdown level, market conditions, and recovery history. | | `PROFILE_CUSTOM` | Uses the manual values defined in the Adaptive Recovery Ratio ML section. | --- ## ๐Ÿค– Machine Learning | Parameter | Default | Description | |-----------|---------|-------------| | `UseMLPrediction` | true | Use the neural network to optimize hedge sizing and timing. | | `BrainFileName` | propwire_brain_v3.bin | File where the Slave's ML model is persisted. | | `LearningRate` | 0.05 | Speed at which the ML model adapts (0.01 = very slow, stable; 0.1 = fast, less stable). | | `MLUpdateIntervalMinutes` | 60 | How often the ML model is retrained with new trade results. | | `MLConfidenceThreshold` | 0.7 | Minimum confidence score (0โ€“1) from the ML model to allow a hedge trade. Below this, the hedge is skipped or sized down. | --- ## ๐Ÿ”„ Adaptive Recovery Ratio ML Fine-grained control over how the ML model adjusts the hedge ratio in real time. | Parameter | Default | Description | |-----------|---------|-------------| | `UseAdaptiveRecovery` | true | Enable dynamic hedge ratio adjustment. When disabled, a fixed ratio is used. | | `MinAdaptiveRatio` | 0.3 | Minimum hedge ratio (0.3 = hedge at 30% of Master lot size). Never hedges less than this. | | `MaxAdaptiveRatio` | 2.0 | Maximum hedge ratio (2.0 = hedge at 200% of Master lot size). Never exceeds this. | | `UseDrawdownProbability` | true | Factor in the current probability of continued drawdown when sizing the hedge. | | `UseRecoveryHistory` | true | Use historical recovery performance to guide ratio selection. | | `UseDistanceToSL` | true | Increase hedge size when the Master position is close to its stop loss (higher urgency). | | `QuickRecoveryThreshold` | 0.6 | ML confidence level above which the Slave attempts an aggressive quick-recovery hedge (larger ratio). | | `ProlongedDDThreshold` | 0.7 | ML risk score above which the Slave detects a prolonged drawdown scenario and adjusts accordingly. | | `AdaptiveVerboseLogging` | false | Log detailed information about each adaptive ratio calculation. Enable for debugging. | --- ## โšก Advanced Risk Management Controls the Slave's own position-level risk limits, independent of what the Master is doing. | Parameter | Default | Description | |-----------|---------|-------------| | `MaxDailyLossPercent` | 2.0 | Maximum daily loss on the Slave account (% of balance). Trading stops if exceeded. | | `MaxTotalDrawdownPercent` | 5.0 | Maximum total drawdown on the Slave account before all activity is halted. | | `MaxSimultaneousHedges` | 10 | Maximum number of concurrent hedge positions on the Slave account. | | `UseVolatilityScaling` | true | Reduce hedge lot size during abnormally high volatility to avoid over-exposure. | | `VolatilityMultiplier` | 1.5 | Volatility ratio threshold above which lot scaling kicks in. | --- ## ๐Ÿ“ก Communication File-based communication settings. These must match the Master EA's communication settings exactly. | Parameter | Default | Description | |-----------|---------|-------------| | `UseSlaveCommunication` | true | Enable file-based communication with the Master EA. | | `SignalsFileName` | signals_master.csv | File the Slave reads for new trade signals from the Master. | | `AckFileName` | signals_ack.csv | File the Slave writes its acknowledgments to. | | `ClosuresFileName` | closures_master.csv | File listing Master position closures. | | `PositionsFileName` | positions_master.csv | Master's position broadcast file. Slave reads this every few seconds for orphan detection. | | `MappingFileName` | ticket_mapping.csv | Mapping between Master and Slave ticket numbers. | | `UseFileCommon` | true | Use MetaTrader's shared `FILE_COMMON` directory. Must match Master. | | `FileCheckIntervalMs` | 200 | How often (in milliseconds) the Slave polls the communication files. 200ms = 5 checks/second. | --- ## ๐Ÿ›ก๏ธ Orphan Protection Detects and closes hedge positions that have been left open after the corresponding Master position was closed. | Parameter | Default | Description | |-----------|---------|-------------| | `UseEnhancedOrphanProtection` | true | Enable orphan position detection. Highly recommended โ€” prevents runaway hedge positions. | | `OrphanCheckIntervalSeconds` | 5 | How often (in seconds) the Slave checks for orphan positions. | | `OrphanGracePeriodSeconds` | 30 | A position must appear orphaned for at least this many seconds before the Slave acts. Prevents false positives from temporary communication delays. | | `OrphanAutoClose` | true | Automatically close orphan positions. If disabled, only an alert is raised. | | `OrphanAlertEnabled` | true | Send an alert (log + notification) when an orphan position is detected. | **How it works:** If the Master's `positions_master.csv` file goes more than `OrphanGracePeriodSeconds` without listing a ticket that the Slave has open, that position is considered an orphan and is closed. --- ## ๐Ÿ”’ Strict Risk Management Hard limits on capital usage to protect the Slave account from catastrophic loss. | Parameter | Default | Description | |-----------|---------|-------------| | `UseStrictRiskManagement` | true | Enable all strict risk controls. | | `MaxCapitalUsagePercent` | 50.0 | Maximum percentage of the Slave account that can be used for margin at any time. If this is reached, no new hedges are opened. | | `CircuitBreakerDDPercent` | 10.0 | Emergency circuit breaker. If the Slave account drawdown reaches this %, all trading halts immediately. | | `UseStrictDailyLossLimit` | true | Enable a hard daily loss ceiling. | | `StrictMaxDailyLossPercent` | 3.0 | If the Slave account loses more than this % in a single trading day, all activity stops for the remainder of the day. | --- ## ๐Ÿ“Š Performance Tracking | Parameter | Default | Description | |-----------|---------|-------------| | `ShowPeriodicStats` | false | Periodically print a performance summary to the log. Enable for monitoring. | | `StatsIntervalSeconds` | 300 | How often (in seconds) the stats summary is printed (300 = every 5 minutes). | --- ## ๐Ÿ”ง Debug & Test | Parameter | Default | Description | |-----------|---------|-------------| | `VerboseLogging` | false | Enable detailed logging of every internal action. Useful for troubleshooting. Warning: generates a very large volume of log output. | | `EnableMLDebug` | false | Log every step of the ML prediction process. Extremely verbose โ€” only use when diagnosing ML issues. | --- --- # Recommended Configurations by Use Case ## Prop Firm Challenge Phase 1 (strict, low drawdown) **Master EA key settings:** ``` TradingProfile = PROFILE_CHALLENGE_PHASE1 RiskPercent = 0.3 MaxDailyLossPercent = 1.5 MaxTotalDrawdown = 4.0 UseICTRules = true RequireSMCConfluence = true MinTypedConfluences = 3 UseSlaveCommunication = true WaitForSlaveAck = true ``` **Slave EA key settings:** ``` RecoveryTargetAmount = [challenge cost in $] MasterAccountBalance = [funded account size in $] MasterMaxDrawdownPercent = [prop firm daily DD limit] RecoveryProfile = PROFILE_CONSERVATIVE UseStrictRiskManagement = true ``` --- ## Funded Account (live, balanced) **Master EA key settings:** ``` TradingProfile = PROFILE_FUNDED_ACCOUNT RiskPercent = 0.5 MaxDailyLossPercent = 2.0 MaxTotalDrawdown = 8.0 UseMLSignalFilter = true MLMinConfidence = 0.55 ``` --- ## Backtesting / Strategy Tester **Master EA key settings:** ``` UseSlaveCommunication = false UseICTRules = false RequireSMCConfluence = false UseTypedConfluences = false UseRegimeForScore = false UseMTFConfluence = false AllowSessionDisable = false BacktestMode = true โ† set automatically, but can force it VerboseLogging = false ``` > **Note:** The Slave EA is not used in backtesting. Set `UseSlaveCommunication = false` on the Master so it does not wait for an ACK that will never come. --- *For architecture details and communication protocol specifications, refer to `docs/` folder.*