miroir de
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synchronisé 2026-04-11 10:20:57 +00:00
💡 What: This optimization caches the results of `SymbolInfo...()` function calls for static symbol properties (like point size, digits, volume steps) in global variables during the `OnInit` phase of the Expert Advisor. 🎯 Why: The `OnTick` function and its downstream helpers were repeatedly calling `SymbolInfo...()` functions for data that never changes during the EA's lifetime. This adds unnecessary overhead to the hot path, as `OnTick` executes on every price change. Caching these values reduces function call overhead and makes the critical execution path faster. 📊 Impact: Reduces the number of function calls on every tick, leading to a small but significant reduction in execution latency. This is a best practice for MQL5 EAs to ensure they react to market changes as quickly as possible. 🔬 Measurement: The improvement can be verified by observing a decrease in the profiler's execution time for the `OnTick` function in the MetaTrader 5 Strategy Tester. The code is also demonstrably cleaner, as the repeated function calls have been removed. |
||
|---|---|---|
| .. | ||
| MQL5 | ||