MQL5-Google-Onedrive/mt5
google-labs-jules[bot] 001011470b Bolt: Add lightweight new-bar check to OnTick
💡 What:
Moved the new-bar check to the beginning of the `OnTick` function using the lightweight `iTime()` call. This prevents the expensive `CopyRates()` function and all subsequent logic from running on every single price tick.

🎯 Why:
The `OnTick` function is a "hot path" that executes on every incoming price tick. The previous implementation performed a heavy `CopyRates()` data copy *before* checking if a new bar had even formed, leading to significant unnecessary processing.

📊 Impact:
This change dramatically reduces the EA's CPU load. Instead of running expensive calculations multiple times per second, the core logic now only runs once per bar on the signal timeframe. This leads to a more efficient and responsive EA, especially on lower chart timeframes with higher-timeframe signals.

🔬 Measurement:
The performance improvement can be verified by monitoring the CPU usage of the terminal running the EA. With this change, the CPU usage will be significantly lower and less spiky, especially during volatile market conditions. The Profiler in MetaEditor would show a drastic reduction in the time spent within the `OnTick` function.
2026-01-01 17:02:33 +00:00
..
MQL5 Bolt: Add lightweight new-bar check to OnTick 2026-01-01 17:02:33 +00:00