forked from animatedread/Warrior_EA
Optimize() scaled lot size off account trade-history streaks with no Magic-number filter (picked up other EAs'/manual trades) and an unconfigurable m_factor stuck at 1.0 (Factor() was never wired from an input), so a 3-trade streak could triple lot size or send it negative. It was also entirely disconnected from what the AI model actually knows about the current setup. Replaced both AdjustRiskAmount()'s linear confidence-only scale and Optimize()'s streak multiplier with one edge-based model: p from the empirically calibrated AI/DB confidence magnitude, b from the trade's real reward:risk ratio (newly bridged from OpenParams() via g_TradeRewardRiskRatio), quarter-Kelly applied and clamped so risk% can only ever scale down from its configured ceiling, never above it.
47 lines
2 KiB
Markdown
47 lines
2 KiB
Markdown
# 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 (`Use_AI_Lot_Sizing` input).
|
|
- **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.*
|