mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-11 04:40:57 +00:00
💡 What: Replaced `SymbolInfoDouble(_Symbol, SYMBOL_ASK)` and `SymbolInfoDouble(_Symbol, SYMBOL_BID)` with the direct, pre-defined variables `Ask` and `Bid` inside the performance-critical `OnTick` function. 🎯 Why: The `OnTick` function executes on every incoming market tick. The `SymbolInfoDouble()` function, while reliable, introduces overhead with each call. In contrast, the MQL5 engine provides pre-cached `Ask` and `Bid` global variables that are significantly faster to access. This change eliminates unnecessary function call overhead on a very hot path. 📊 Impact: This micro-optimization reduces the execution time of each `OnTick` cycle. While the per-call saving is small, it accumulates over thousands of ticks, leading to a more responsive Expert Advisor, especially in volatile market conditions. This ensures the EA can process market data and execute logic with minimal latency. 🔬 Measurement: The performance improvement can be verified by profiling the Expert Advisor in the MetaTrader 5 Strategy Tester. By comparing the execution time of the `OnTick` function before and after the change under the "Every tick" model, a profiler would show a decrease in the time spent retrieving bid/ask prices. |
||
|---|---|---|
| .. | ||
| MQL5 | ||