forked from LengKundee/MQL5-Google-Onedrive
💡 What: This change defers the calculation of the Donchian Channel high and low within the `OnTick()` function, only performing the calculation if the Donchian breakout feature or the Donchian-based take-profit mode is enabled. 🎯 Why: Previously, the Donchian Channel values were calculated on every new bar, even if the user had disabled the features that rely on them. This caused unnecessary CPU load from the `iHighest` and `iLowest` function calls, which are expensive as they iterate over historical bar data. 📊 Impact: This optimization reduces CPU usage for users who are not utilizing the Donchian Channel features. The EA will run more efficiently, consuming fewer resources, especially on lower-end machines or in environments running many EAs simultaneously. The impact is most significant when the Donchian lookback period is large. 🔬 Measurement: 1. Run the EA in the Strategy Tester with `UseDonchianBreakout = false` and `TPMode != TP_DONCHIAN_WIDTH`. 2. Profile the execution time of the `OnTick()` function. 3. Compare the profiling results with the previous version of the code. The optimized version should show a measurable reduction in the average time spent inside `OnTick()`. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||