forked from LengKundee/MQL5-Google-Onedrive
💡 What: This optimization wraps the calculation of swing high/low points (fractals) within a conditional block in the `OnTick()` function. 🎯 Why: The fractal data, which requires expensive `CopyBuffer` calls, was being calculated on every single price tick, even when the user-facing features that depend on it (`UseSMC` for market structure and `SL_SWING` for stop loss) were disabled. This resulted in unnecessary processing and wasted CPU cycles. 📊 Impact: This change prevents the two `CopyBuffer` calls and the subsequent loop from running when they are not needed. For users who have `UseSMC = false` and `SLMode != SL_SWING`, this will reduce the execution time of the `OnTick` function, leading to a more efficient and responsive Expert Advisor. 🔬 Measurement: The improvement can be verified by using the MetaTrader 5 Strategy Tester with and without the `UseSMC` and `SL_SWING` features enabled. The execution time of the EA will be lower when these features are disabled. |
||
|---|---|---|
| .. | ||
| MQL5 | ||