Warrior_EA/Money
Repository files (latest commit first)
Filename Latest commit message Latest commit date
AnimateDread 77e8080cfe fix: four risk-layer holes a funded account would eventually find
1. The expectancy stop was stone dead at shipped defaults. Its only feed -
   RecordTradeResult inside CTradeJournalManager::Update() - ran solely under
   UseDatabaseRanking, which ships false, so the da54639 halt was armed
   (ExpectancyMinTrades=40) and never received a single closed trade. A risk
   rule must not be a side effect of an analytics toggle: the journal gains
   InitTrackingOnly(), Update() runs unconditionally from OnTick and skips
   only the DB insert when no DB was initialized.

2. Below-minimum lots were silently bumped UP to SYMBOL_VOLUME_MIN by
   TCNormalizeVolume - correct for a user-entered fixed lot, but in the
   risk-sizing path it turned a budget-capped 0.05 into 0.10 on min-0.10/
   step-0.01 symbols: double the intended risk, after CapRiskAmount already
   clamped, exactly the routine-stop-out-breaches-the-daily-limit scenario
   the budget exists to close. CMoneyRiskBase now refuses the trade when the
   risk-derived lot is below the broker minimum.

3. All trading was async fire-and-forget (SetAsyncMode(true)) with no
   OnTradeTransaction handler and no retry: server retcodes were never
   observed. Fail-safe for entries, not for closes - a silently rejected
   close rode the position until the next bar (or next day for the timed
   close window). Now synchronous, matching the risk-budget flatten's own
   already-synchronous CTrade; on an H1 EA the latency is irrelevant.

4. FIXED_LOT bypassed the budget entirely (no CapRiskAmount, no
   OpenRiskAtStops) - pre-halt it could commit more than the remaining daily
   allowance. A fixed lot cannot be scaled, so the rule is binary: its
   loss-to-stop fits the remaining allowance whole or the trade is refused;
   unpriceable risk (no SL) is refused while the budget is enabled.

Compile: 0 errors, 0 warnings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 18:14:26 -04:00
..
Money.mqh convert 2025-05-30 16:35:54 +02:00
MoneyFixedLot.mqh fix: four risk-layer holes a funded account would eventually find 2026-08-11 18:14:26 -04:00
MoneyFixedRisk.mqh refactor(Money): extract CMoneyRiskBase to remove FixedRisk/Intelligent duplication 2026-07-18 15:53:04 -04:00
MoneyIntelligent.mqh feat: remove Min_Risk_Reward_Ratio - a guess was overriding a measurement 2026-08-09 14:51:59 -04:00
MoneyRiskBase.mqh fix: four risk-layer holes a funded account would eventually find 2026-08-11 18:14:26 -04:00
README.md feat: restructure input enums with intelligent SL/TP and AI exit 2026-07-22 13:33:56 -04:00

Money Management Subsystem (Money/)

Overview

The Money/ directory contains all money management logic for the Warrior EA. It provides multiple strategies for position sizing, ranging from simple fixed lots to adaptive, streak-based approaches. Each strategy is encapsulated in its own class and can be selected/configured as needed.

Components

Money.mqh

  • Aggregates all money management strategies.
  • Includes: MoneyFixedRisk, MoneyFixedLot, MoneyIntelligent.
  • Entry point for money management logic selection.

MoneyFixedLot.mqh

  • Class: CMoneyFixedLot
  • Purpose: Fixed lot size per trade.
  • Key Features:
    • User-defined lot size (m_lots).
    • Validates lot size against symbol min/max/step constraints.
    • Simple, robust, suitable for static position sizing.

MoneyFixedRisk.mqh

  • Class: CMoneyFixedRisk
  • Purpose: Risk-based position sizing.
  • Key Features:
    • Calculates lot size based on account balance and risk percentage (m_percent).
    • Ensures risk per trade is controlled.
    • Handles both long and short positions.
    • Validates margin and volume constraints.

MoneyIntelligent.mqh

  • Class: CMoneyIntelligent
  • Purpose: Edge-based, AI-confidence-driven money management (selected via MM_STRATEGY = INTELLIGENT; AI lot scaling is always on).
  • Key Features:
    • Scales risk% via a quarter-Kelly criterion: uses the empirically calibrated AI/DB confidence magnitude as the win-probability estimate (p) and the specific trade's real reward:risk ratio (bridged from OpenParams()) as the payoff ratio (b).
    • Only ever scales the configured Money_Risk_Percent down from its input ceiling, never above it.
    • Suitable for advanced, AI/ML-driven strategies.

Integration Notes

  • All strategies derive from a common base (CExpertMoneyCustom).
  • Designed for modularity and easy extension.
  • Can be further enhanced with AI/ML-driven logic for dynamic risk and position sizing.

Documented April 2026. For modernization and AI/ML integration, see AI_NETWORK.md and project roadmap.