forked from animatedread/Warrior_EA
Audit turned up a real gap for a prop-firm-portfolio-manager use case: nothing in this codebase watched for account-level daily-loss or max-drawdown breaches - the single most common way a prop-firm evaluation actually gets failed. New Signals/SignalRiskGuard.mqh (CSignalRiskGuard), wired into the exact same filter-composition chain as SignalNewsFilter/ SignalSessionFilter (CreateSignalWithRetry/AddFilterToSignal, no new architecture). Vetoes new entries only (never closes existing positions - a materially bigger behavior change, left to the trader/EA's own SL/TP handling) once either MaxDailyLossPct or MaxDrawdownPct (new RISK_LIMIT_PCT_PRESET inputs, both default disabled) is breached. Peak equity and the current broker day's starting balance persist to a small local per-symbol-per-magic state file - peak equity in particular must survive a restart to mean anything, otherwise a restart would silently reset drawdown tracking. New RISK_LIMIT_PCT_PRESET enum (2/3/4/5/8/10/15/20%) rather than reusing PERCENTAGE_PRESETS, which steps by 10 starting at 10 - too coarse for prop-firm-style limits (commonly single-digit daily loss, ~8-10% max drawdown). Compiled clean (MetaEditor, 0 errors/0 warnings). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
21 lines
1.3 KiB
MQL5
21 lines
1.3 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Warrior_EA |
|
|
//| AnimateDread |
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
string eaName = "Warrior_EA";
|
|
string tableschema = "year INTEGER, month INTEGER, day INTEGER, dayOfWeek INTEGER, hour INTEGER, minutes INTEGER, pattern STRING, direction STRING, entryPrice DOUBLE, exitPrice DOUBLE, result STRING";
|
|
bool IsBacktesting = false;
|
|
bool EnableITF = true;
|
|
bool EnableSessionFilter = true;
|
|
bool EnableNewsFilter = true;
|
|
bool EnableRiskGuard = true;
|
|
bool EnablePAI = (AIType == 0 || AIType == 3);
|
|
bool EnableCONV = (AIType == 1 || AIType == 3);
|
|
bool EnableLSTM = (AIType == 2 || AIType == 3);
|
|
//--- Unlike the Enable* flags above (fixed from inputs at file-load time), this one is only known at
|
|
//--- runtime - OnInit() sets it from CheckMarketDepthAvailability() before any signal is created, and
|
|
//--- OnDeinit() reads it back to decide whether MarketBookRelease() is needed. See
|
|
//--- Signals\SignalMarketDepth.mqh's class-level comment.
|
|
bool g_marketDepthAvailable = false;
|
|
//+------------------------------------------------------------------+
|