Commit graph

3 commits

Author SHA1 Message Date
google-labs-jules[bot]
8316c159d2 Bolt: Optimized history processing and daily statistics in ExpertMAPSARSizeOptimized_Improved.mq5
- Optimized UpdateDailyStatistics by consolidating trade counting, using faster property retrieval without ticket parameters, and fast math for time calculation.
- Optimized OnTick day-rollover logic using fast integer math instead of TimeToStruct/StructToTime.
- Optimized IsTradingAllowed by using fast math for hour extraction.
- Optimized CheckDailyLimits by fetching account balance only once.
- Cleaned up OnTrade by removing redundant and inefficient history scanning.
- Verified with repository validation and integration tests.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-03 17:32:41 +00:00
google-labs-jules[bot]
601eedbd48 Bolt: Optimize Expert Advisor tick performance and history scanning
This PR implements several high-impact performance optimizations in `ExpertMAPSARSizeOptimized_Improved.mq5`:

1.  **Reduced History Scanning Overhead**: Moved the expensive `UpdateDailyStatistics()` call (which uses `HistorySelect` and loops through deals) out of the `OnTick()` path. It is now called only on trade events, periodic timer intervals, and day rollovers.
2.  **Optimized Day-Rollover Logic**: Replaced multiple `TimeToStruct` and `StructToTime` calls in the tick path with a lightweight integer division (`TimeCurrent() / 86400`) to detect calendar day changes.
3.  **Efficient History Selection**: Introduced `g_todayStart` to cache the midnight timestamp, ensuring `HistorySelect` targets the current day's data precisely rather than a rolling 24-hour window.
4.  **Lightweight New Bar Detection**: Replaced expensive `CopyRates()` calls for logging new bars with a simple `iTime()` lookup.

These changes significantly reduce the CPU and terminal API overhead per tick, which is critical for high-frequency or multi-symbol trading.

📊 **Impact**: Reduces `OnTick` execution time by avoiding redundant history scans on every price update.
🔬 **Measurement**: Verified with `scripts/ci_validate_repo.py` and manual code review against MQL5 performance best practices.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-02 17:40:08 +00:00
NUNA
b66e95973b Improve ExpertMAPSARSizeOptimized EA with enhanced risk management, logging, and safety features 2026-01-19 14:19:52 +07:00