forked from LengKundee/MQL5-Google-Onedrive
This commit optimizes the lot size calculation in `SMC_TrendBreakout_MTF_EA.mq5` by: 1. Pre-calculating the inverse of `SYMBOL_MARGIN_INITIAL` in `OnInit` to replace division with multiplication. 2. Refactoring `CalculateLots()` to apply margin clamping before normalization, ensuring a single execution path for rounding and limit checks. 3. Reducing redundant math operations in the trade execution path. Performance Impact: - Reduces redundant `MathFloor`, `MathMax`, `MathMin`, and multiplication operations in `CalculateLots`. - Replaces expensive division with faster multiplication. - Improves code readability and maintainability by applying the DRY principle. Verification: - Ran `python scripts/ci_validate_repo.py` and `python scripts/test_automation.py`. - Manually verified the logic flow for both normal and margin-clamped scenarios. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||