MQL5-Google-Onedrive/mt5
google-labs-jules[bot] cce5d5025e Bolt: Add new bar check to OnTick to prevent redundant calculations
💡 What: Adds an "early exit" guard at the beginning of the `OnTick()` function. This check ensures that the main body of the function only executes when a new bar has formed on the signal timeframe.

🎯 Why: Previously, the expensive `CopyRates` function and all subsequent indicator logic were executed on every single price tick. Since the EA's trading logic is bar-based, this resulted in a significant amount of redundant computation, wasting CPU resources.

📊 Impact: This optimization drastically reduces the EA's CPU usage. The core logic now runs only once per bar instead of multiple times per second, potentially reducing the number of expensive calculations by over 99%, especially in volatile markets.

🔬 Measurement: The performance improvement can be verified by profiling the EA in the MetaTrader 5 Strategy Tester. A significant reduction in the total execution time for a given backtest period will be observed. Alternatively, monitoring the CPU usage of the terminal with the EA running on a live chart will show a noticeable decrease in resource consumption.
2026-01-07 17:09:07 +00:00
..
MQL5 Bolt: Add new bar check to OnTick to prevent redundant calculations 2026-01-07 17:09:07 +00:00