forked from LengKundee/MQL5-Google-Onedrive
This commit implements several performance optimizations in the SMC_TrendBreakout_MTF_EA.mq5: 1. **Early Exit:** Moved the `PositionSelect` check to the beginning of the `OnTick` handler (after the new bar check). This avoids expensive market data fetching (`CopyRates`, `CopyBuffer`) and signal calculations if a position is already open. 2. **Reduced Data Fetching:** Reduced the fetch count in `CopyRates` and `CopyBuffer` (Donchian/EMA) from 3 to 2, as only the current and previous bars are used in the logic. 3. **Lazy Price Fetching:** Replaced the undefined/redundant `Ask` and `Bid` variables with efficient price retrieval using `SymbolInfoTick` only when a signal is confirmed. 4. **Optimized Array Management:** Refactored occasionally-used indicator buffers (EMA, ATR) into fixed-size local arrays to avoid dynamic allocation overhead and potential shadowing issues identified during code review. These changes measurably reduce the terminal overhead on every new bar and ensure better resource utilization during live trading. Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| bolt.md | ||
| deploy.yml | ||