forked from LengKundee/MQL5-Google-Onedrive
This commit implements significant performance optimizations for the Expert Advisor's hot path: 1. **Environment API Caching**: Implements 1-second caching for `TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)` and `MQLInfoInteger(MQL_TRADE_ALLOWED)`. These cross-process API calls were previously executed on every price tick, causing unnecessary overhead. 2. **Pre-calculated Time Bounds**: Trading start and end hours are now pre-calculated into seconds since midnight during `OnInit`. 3. **Optimized Time Filter**: Replaces expensive hour-extraction math in `IsTradingAllowed` with fast modulo arithmetic (`now % 86400`) and simple integer comparisons against the pre-calculated bounds. These changes reduce CPU overhead and improve execution speed during high market volatility. |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||