mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-11 08:20:58 +00:00
💡 What: Added a guard at the beginning of the `OnTick()` function to ensure the main logic only runs once per new bar. 🎯 Why: The `OnTick()` function was executing expensive operations like `CopyRates()` on every single price tick. For a bar-based strategy, these calculations only need to happen when a new bar is formed. 📊 Impact: This change dramatically reduces the EA's CPU usage. Instead of running heavy calculations multiple times per second, it now only runs them once per bar, leading to significantly more efficient operation and preventing potential freezes or slowdowns in the trading terminal. 🔬 Measurement: The improvement can be verified by observing the EA's processing time in the MetaTrader 5 Strategy Tester. A before-and-after comparison will show a drastic reduction in the total time taken to process the same historical data period. The number of calls to `OnTick` that perform work will be reduced from thousands or millions to just the number of bars in the test period. |
||
|---|---|---|
| .. | ||
| MQL5 | ||