
A confidence score can tell an EA when to enter a trade, but it says nothing about how much to risk, or whether that new trade is secretly doubling down on exposure the account already has open. Those two problems — position sizing and correlated exposure — are handled by two separate, deliberately simple modules in a modular self-learning MT5 EA: a pure percentage-risk MoneyManager, and a Pearson correlation-based exposure filter.
Position Sizing: Percentage Risk, No Martingale or Grid
The MoneyManager module calculates lot size from a single input: a fixed percentage of account equity risked per trade, combined with the stop-loss distance for that specific setup. This is worth stating plainly because it's a deliberate design choice, not an oversight: there is explicitly no martingale multiplier and no grid-based lot scaling anywhere in this module. Position size depends only on account risk percentage and stop distance — never on a losing streak, never on a previous trade's outcome. A losing trade simply doesn't change how the next trade is sized.
Exit Logic Beyond a Single Stop-Loss
The RiskManager module handles far more than opening SL/TP levels. It manages break-even moves once a trade reaches a defined profit threshold, ATR-based trailing stops (with an optional structure-based trailing mode that follows swing points instead of a fixed distance), partial position closes and scale-outs at intermediate profit targets, and both time-based and emergency exits. Take-profit is deliberately set at 3R rather than a tighter 2R specifically so that a partial close at 1.5R and a scale-out at 2.5R both have room to actually trigger before the position hits its final target — a tighter TP would cap the trade before either intermediate exit could fire.
The Overlooked Risk: Correlated Exposure Across Symbols
An EA can size every individual trade conservatively and still end up dangerously overexposed — if it opens long positions on multiple symbols that tend to move together, a single adverse market move can hit all of them at once. The CorrelationFilter module addresses this directly: it calculates Pearson correlation across the symbols the EA is trading, and uses that to avoid stacking new positions in the same effective direction as existing correlated exposure. A conservative 0.5% risk per trade on three highly correlated pairs can still behave, in a sharp move, like a much larger single position — the correlation filter exists specifically to catch that.
A Practical Warning: Safety Limits Disabled for Demo Training
One detail worth flagging for anyone studying or adapting a similar EA: several of the safety limits in this system's configuration — daily, weekly, and monthly loss percentage caps, maximum drawdown percentage, emergency-exit drawdown percentage, and maximum daily trade count — were deliberately set to loose or effectively disabled values during the demo/data-collection phase (for example, a 50% emergency drawdown threshold, 20 max daily trades, and 100% daily/weekly/monthly loss caps). These are marked inline with comments explicitly noting they are "DISABLED for demo training" and must be restored before the EA goes anywhere near a live account.
This is a genuinely useful pattern for anyone building or testing a self-learning EA: loosening safety limits during the data-collection phase lets the EA generate a large, unfiltered sample of trade outcomes without the Learning Engine's own statistics being interrupted by early, overly conservative safety stops. But it only works safely if those same limits are just as deliberately tightened back up before any real capital is at risk — a loosened limit left in place by accident is exactly the kind of gap that turns into an account-blowing mistake.
Why Separating These Concerns Matters
Keeping position sizing, exit management, and correlation-based exposure control as three distinct modules — rather than folding correlation logic into the MoneyManager, for example — makes each piece independently testable and easier to reason about. A trader can verify that position sizing behaves correctly in isolation, confirm exit logic separately, and audit the correlation filter's behavior on its own, rather than debugging one large function that tries to do all three at once.
Related Reading
- SuperTrend Martingale EA for XAUUSD: Phase A/B Self-Learning Engine Explained (MT5)
- Inside a Self-Learning MT5 EA's 8-Factor SMC Confidence Score (and a Learning Engine Bug)
- From 3 Failed Hedging EAs to a Simple EMA Crossover: An MT5 Multi-Account Case Study
- Grading Structure Breaks in an MT5 SMC EA: The V1.49 Structure Scoring Redesign
0 Comments