forked from LengKundee/MQL5-Google-Onedrive
💡 What: This optimization introduces a lightweight new-bar check using `iTime()` at the very beginning of the `OnTick()` function. This prevents the expensive `CopyRates` call and all subsequent trading logic from executing on every single price tick. 🎯 Why: Previously, the EA performed resource-intensive calculations on every tick, even though the logic is only relevant once per bar. This caused significant and unnecessary CPU load, especially in active markets. The new-bar check was happening *after* the expensive `CopyRates` call, defeating its purpose. 📊 Impact: This change dramatically reduces the EA's CPU consumption. By exiting early on most ticks, the EA becomes far more efficient, ensuring it runs smoothly without slowing down the trading terminal or VPS. 🔬 Measurement: The performance improvement can be measured by comparing the execution time of a backtest in the MetaTrader 5 Strategy Tester before and after the change. A noticeable reduction in the total time indicates the optimization's success. Alternatively, one could observe the terminal's CPU usage with the EA running on a live chart, which will be significantly lower with this patch. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||