MQL5-Google-Onedrive/mt5
google-labs-jules[bot] ef4b2ed0d5 feat(performance): Add new bar check to OnTick()
💡 What:
This commit introduces a performance optimization to the `OnTick()` function in the main Expert Advisor. It adds a check at the very beginning of the function to determine if a new bar has formed on the signal timeframe.

🎯 Why:
The `OnTick()` function is executed on every incoming price tick, which can happen multiple times per second. The core trading logic, however, is based on analyzing closed bars. Without this check, the EA was performing expensive calculations (like `CopyRates`, indicator calculations, and loop-based analysis) on every single tick, even when no new trading information was available. This was highly inefficient and consumed unnecessary CPU resources.

📊 Impact:
This change dramatically reduces the EA's computational overhead. The expensive logic inside `OnTick()` will now run only once per bar, instead of on every tick. This leads to a significant reduction in CPU usage, making the EA run much more efficiently, especially in volatile markets.

🔬 Measurement:
The improvement can be verified by observing the EA's execution frequency in the MetaTrader 5 "Experts" tab. Before this change, the log would show frequent processing. After this change, processing logs will only appear once at the beginning of each new bar on the selected timeframe.
2026-01-05 17:04:38 +00:00
..
MQL5 feat(performance): Add new bar check to OnTick() 2026-01-05 17:04:38 +00:00