💡 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.
💡 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.
What:
Caches the results of `SymbolInfo...` calls (e.g., tick size, volume step, point value) into global variables once during the Expert Advisor's `OnInit` function. Helper functions and `OnTick` logic are refactored to use these cached values instead of making repeated calls.
Why:
The `OnTick` function is executed frequently, and the `SymbolInfo...` functions involve lookups that are unnecessary to repeat for static data. This repeated lookup adds processing overhead to every tick, which can be significant in volatile markets. Caching these values reduces the per-tick workload, making the EA more efficient.
Impact:
This change is expected to reduce the execution time of the `OnTick` function, leading to faster response times and lower CPU usage. While the exact impact depends on market conditions and broker execution, this is a standard and effective optimization practice in MQL5.
Measurement:
The performance improvement can be verified by profiling the EA's `OnTick` execution time in the MetaTrader 5 Strategy Tester before and after the change. A noticeable reduction in the average execution time per tick is expected.
This commit adds documentation for the installation and setup of the following CLI tools:
- Jules CLI
- Cursor CLI
- Firebase CLI
- Docker CLI
- GitHub CLI
The documentation is located in the `docs` directory.
Replaced the manual `HighestHighMql` and `LowestLowMql` loops with the built-in, native MQL5 functions `iHighest` and `iLowest`.
This change improves performance within the `OnTick` handler by leveraging optimized, pre-compiled platform functions instead of slower, scripted iterations. This leads to a more efficient and responsive Expert Advisor.