mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-11 04:30:56 +00:00
This commit implements several performance optimizations in the `SMC_TrendBreakout_MTF_EA.mq5` Expert Advisor: 1. **Lazy Account Info Retrieval**: Refactored `OnTick` to fetch `ACCOUNT_BALANCE`, `ACCOUNT_EQUITY`, and `ACCOUNT_MARGIN_FREE` only when a signal is confirmed and based on current risk settings. This significantly reduces terminal API calls. 2. **Local Fixed-Size Arrays**: Replaced `static` dynamic arrays with local fixed-size arrays for `emaFast`, `emaSlow`, and `atr` data. This avoids the overhead of dynamic memory management and `ArraySetAsSeries`. 3. **Redundant Calculation Removal**: Optimized `OpenBuyTrade` and `OpenSellTrade` by pre-calculating `slDistance` once and passing it to `CalculateTP` and `CalculateLots`. 4. **Optimized Function Signatures**: Updated `CalculateTP` and `CalculateLots` to accept only the necessary metrics and pre-calculated values. These changes result in a leaner "hot path" and reduced overhead during trade execution. |
||
|---|---|---|
| .. | ||
| ExpertMAPSARSizeOptimized_Improved.mq5 | ||
| SMC_TrendBreakout_MTF_EA.mq5 | ||