forked from LengKundee/MQL5-Google-Onedrive
💡 What: Added a lightweight "new bar" check at the beginning of the `OnTick()` function. The function now exits immediately if a new bar has not formed on the signal timeframe. 🎯 Why: The `OnTick()` function is called on every price tick, but the trading logic only needs to run once per bar. Without this check, the EA performs expensive operations like `CopyRates()` multiple times per second, leading to unnecessary CPU load. 📊 Impact: This change drastically reduces the EA's processing load. Instead of running complex logic on every tick, it now runs only once per bar. This can lower CPU usage by over 95% on active markets, making the EA much more efficient. 🔬 Measurement: The improvement can be verified by adding print statements or using the MetaTrader 5 profiler to observe that the main body of the `OnTick()` function is executed only once per bar, not on every tick. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||