MQL5-Google-Onedrive/mt5/MQL5
google-labs-jules[bot] e9bed4c71d feat(perf): Add early exit to OnTick if new bar not formed
💡 What: This commit introduces an 'early exit' guard at the beginning of the `OnTick()` function in the main Expert Advisor. It checks if a new bar has formed on the signal timeframe before proceeding with any further calculations.

🎯 Why: The `OnTick()` function is executed on every incoming price tick. Previously, it would call expensive functions like `CopyRates()` and perform all trading logic on every single tick, even if no new bar had appeared. This resulted in significant redundant computation and unnecessary CPU load.

📊 Impact: This optimization ensures the core trading logic runs only once per bar instead of on every tick. For a typical currency pair, this can reduce the number of executions by a factor of 10-100x or more, leading to a significant reduction in CPU usage and a more efficient EA, especially during volatile market conditions.

🔬 Measurement: The improvement can be measured by profiling the EA's execution time in the MetaTrader 5 Strategy Tester or by observing the reduced CPU load of the terminal when the EA is running on a live chart. The difference will be most noticeable on lower timeframes (e.g., M1, M5) where tick frequency is high.
2026-01-06 19:56:39 +00:00
..
Experts feat(perf): Add early exit to OnTick if new bar not formed 2026-01-06 19:56:39 +00:00
Indicators feat: Add SL/TP modes and risk management to EA 2025-12-26 08:17:39 +00:00