forked from LengKundee/MQL5-Google-Onedrive
💡 What: This optimization defers the calculation of Donchian channel high and low values inside the `OnTick()` function, wrapping it in a conditional block. 🎯 Why: The `iHighest` and `iLowest` functions were being called on every new bar, even when the user had disabled the "Donchian Breakout" feature and was not using the "Donchian Width" Take Profit mode. This caused unnecessary computational load in a performance-critical code path. 📊 Impact: This change prevents unnecessary function calls, reducing CPU usage for users who are not actively using the Donchian channel features. While the impact per tick is small, it accumulates significantly over the lifetime of the EA, leading to a more efficient and responsive script. 🔬 Measurement: To verify, one could add logging or profiling around the `iHighest`/`iLowest` calls. When `UseDonchianBreakout` is `false` and `TPMode` is not `TP_DONCHIAN_WIDTH`, the logs should show that the functions are no longer called on new bars. |
||
|---|---|---|
| .. | ||
| MQL5 | ||