forked from LengKundee/MQL5-Google-Onedrive
💡 What: This change introduces a check at the very beginning of the `OnTick()` function. It uses the lightweight `iTime()` function to see if a new bar has formed on the signal timeframe and exits immediately if it hasn't. 🎯 Why: The `OnTick()` function is executed on every incoming price tick, which can be very frequent. The core logic of the EA, including the expensive `CopyRates()` call and subsequent indicator calculations, only needs to run once per bar. This change prevents these expensive operations from running needlessly on every tick. 📊 Impact: This optimization drastically reduces the EA's CPU usage. Instead of running the entire calculation logic multiple times per second, it will now run only once when a new bar appears. This makes the EA far more efficient and reduces the load on the MetaTrader terminal. 🔬 Measurement: The performance improvement can be verified by observing the "Experts" tab in the MT5 terminal. Before this change, any log/print statements inside `OnTick` would fire on every price update. After this change, they will only fire once at the beginning of each new bar.
5 lines
97 B
Markdown
5 lines
97 B
Markdown
# Bolt's Journal ⚡
|
|
|
|
This journal is for CRITICAL, non-routine performance learnings ONLY.
|
|
|
|
---
|