MQL5-Google-Onedrive/mt5/MQL5
google-labs-jules[bot] bf648f5ef4 Bolt: Defer ATR calculation to improve performance
💡 What: This change refactors the ATR (Average True Range) calculation in the `OnTick` function to be lazy-loaded. Instead of being calculated on every tick, the ATR value is now only fetched when it is explicitly needed by the Stop Loss or Take Profit logic.

🎯 Why: The previous implementation fetched the ATR value using `CopyBuffer` on every valid tick, even if the user's configuration (e.g., `SL_FIXED_POINTS`) did not use the ATR. This resulted in unnecessary processing in a performance-critical function.

📊 Impact: This optimization reduces the number of `CopyBuffer` calls, which can be expensive. For configurations that do not use ATR-based stops or take-profits, this eliminates the ATR calculation entirely from the `OnTick` function, leading to a measurable performance improvement.

🔬 Measurement: To verify the improvement, one could run the EA in the MetaTrader 5 Strategy Tester with a configuration that does not use ATR (e.g., SLMode = SL_FIXED_POINTS). A profiler would show that the `CopyBuffer` call for the ATR handle is no longer being made on every tick.
2026-01-10 19:18:25 +00:00
..
Experts Bolt: Defer ATR calculation to improve performance 2026-01-10 19:18:25 +00:00
Indicators feat(mql5): cache MTF confirmation to reduce CPU load (#78) 2026-01-10 05:36:08 +07:00