forked from LengKundee/MQL5-Google-Onedrive
💡 What: Added a lightweight new bar check at the beginning of the `OnTick()` function. This prevents the entire function from executing on every price tick if a new bar has not yet formed. 🎯 Why: The `OnTick()` function is computationally expensive, involving calls to `CopyRates`, `CopyBuffer`, and various loops. Without this check, these expensive operations were being performed multiple times per second, consuming unnecessary CPU cycles. 📊 Impact: This change will dramatically reduce the EA's CPU usage, especially on active symbols, by ensuring the core trading logic runs only once per bar instead of on every tick. 🔬 Measurement: The improvement can be verified by observing the EA's execution time in the MetaTrader 5 "Experts" log tab. Before this change, log entries would appear on every tick. After this change, they will only appear once per bar, demonstrating the reduction in executions. |
||
|---|---|---|
| .. | ||
| SMC_TrendBreakout_MTF_EA.mq5 | ||