forked from LengKundee/MQL5-Google-Onedrive
💡 What: This change caches the `ask` and `bid` prices at the beginning of the `OnTick()` function and passes them as arguments to the `OpenBuyTrade()` and `OpenSellTrade()` functions. This eliminates redundant calls to `SymbolInfoDouble()` within the trade execution functions. 🎯 Why: The `OnTick()` function is a performance-critical hot path. The original code made unnecessary, duplicate calls to fetch symbol price information, adding overhead to every tick that resulted in a trade signal. 📊 Impact: Reduces redundant function calls in the `OnTick` execution path. While a micro-optimization, this improves the overall efficiency of the EA by ensuring price information is fetched only once per tick. 🔬 Measurement: The code's correctness is verified by the existing automated test suite. The performance impact can be confirmed by profiling the EA in the MT5 Strategy Tester, where a slight reduction in the execution time of `OnTick` can be observed. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||