forked from LengKundee/MQL5-Google-Onedrive
**💡 What:** Added a lightweight check at the beginning of the `OnTick()` function to exit early if a new bar has not formed. **🎯 Why:** The `OnTick()` function runs on every price tick, but the trading logic only needs to be evaluated once per bar. Without this check, the EA performs expensive calculations (like `CopyRates`) unnecessarily, consuming significant CPU resources. **📊 Impact:** This change will dramatically reduce the EA's CPU usage. The expensive logic will now run only once per bar instead of on every tick, leading to a potential reduction of over 99% in function calls depending on market volatility. **🔬 Measurement:** The improvement can be verified by observing the CPU usage of the MetaTrader 5 terminal when this EA is running on a chart. Before the change, CPU usage would spike with every tick. After the change, it will remain low, with small spikes only at the opening of a new bar. |
||
|---|---|---|
| .. | ||
| MQL5 | ||