MQL5-Google-Onedrive/mt5/MQL5
google-labs-jules[bot] b53ac92a2e feat(perf): Defer MTF confirmation until after primary signal
💡 What: This optimization refactors the `OnTick` function to defer the call to `GetMTFDir()` (which performs multi-timeframe analysis) until after a primary breakout signal (SMC or Donchian) is confirmed.

🎯 Why: The `OnTick` function is a performance-critical hot path that runs on every price tick. The `GetMTFDir()` function is a relatively expensive operation. The original code called this function on every new bar, even when no potential trade signal existed, leading to unnecessary computation.

📊 Impact: This change significantly reduces the EA's computational load. The `GetMTFDir()` function will now only be called on the small fraction of bars where a valid breakout signal occurs, instead of on every single bar. This leads to lower CPU usage and a more efficient EA, especially on volatile instruments with many ticks.

🔬 Measurement: The improvement can be verified by adding logging or profiling timers around the `GetMTFDir()` call and observing that it is invoked far less frequently during a backtest or live trading compared to the previous version. The overall `OnTick` execution time, measured in the MetaTrader 5 Strategy Tester, will show a reduction.
2026-01-12 17:29:21 +00:00
..
Experts feat(perf): Defer MTF confirmation until after primary signal 2026-01-12 17:29:21 +00:00
Indicators feat(mql5): cache MTF confirmation to reduce CPU load (#78) 2026-01-10 05:36:08 +07:00