Commit graph

12 commits

Author SHA1 Message Date
google-labs-jules[bot]
a097b8b1ba Bolt: Optimized dashboard markdown rendering with lazy caching
Profiled scripts/web_dashboard.py and identified redundant disk I/O and
markdown parsing as a primary latency bottleneck.

Implemented a MarkdownCache class with:
- Lazy loading to avoid I/O on cold starts.
- mtime-based tracking to skip re-rendering unless the source file changes.
- Pre-calculated module-level constants for file paths.

Performance Impact:
- Baseline Latency: 33.48ms
- Optimized Latency: 7.58ms (~77% improvement)

Verified via:
- scripts/benchmark_dashboard.py (custom benchmark)
- scripts/ci_validate_repo.py
- scripts/test_automation.py
- Playwright frontend verification script (dashboard.png)
2026-02-12 10:40:14 +00:00
google-labs-jules[bot]
d6fdac641a Bolt: Optimize Daily Limit Checks and OnTick Flow
This commit improves the performance and efficiency of the `ExpertMAPSARSizeOptimized_Improved.mq5` Expert Advisor by:

1.  **Optimizing `CheckDailyLimits`**: Added a `static datetime lastLimitLogDay` flag to throttle logs and alerts. Once a daily limit is reached, subsequent calls for the rest of the day exit immediately, avoiding redundant string formatting, logging, and expensive `Alert()` API calls on every tick.
2.  **Optimizing `OnTick` Flow**: Reordered the execution path to call `CheckDailyLimits()` before `IsTradingAllowed()`. This prioritizes cheap, internal math checks over more expensive terminal environment API calls (`TerminalInfoInteger`, `MQLInfoInteger`), allowing the EA to exit significantly faster when trading is halted by daily limits.

These changes reduce CPU overhead in the "hot path" and eliminate log/alert flooding during high volatility.
2026-02-11 10:57:42 +00:00
google-labs-jules[bot]
57af0c49e7 Bolt: Optimize ExpertMAPSAR execution flow and resource usage
- Pre-calculate daily risk factors (g_lossFactor, g_profitFactor) in OnInit to replace divisions with multiplications in statistics updates.
- Reorder IsTradingAllowed to perform time filter checks before expensive terminal API calls (TerminalInfoInteger, MQLInfoInteger).
- Implement log throttling for trading status messages to prevent flooding during high-frequency ticks.
- Guard new bar debug check in OnTick with log level check to avoid redundant iTime calls.
- Fix invalid LogInfo/LogDebug calls by switching from multiple arguments to string concatenation.
- Optimize Day-Rollover check in OnTick by using casted long for day calculation.
2026-02-09 19:37:26 +00:00
google-labs-jules[bot]
ca2fcb7cee Bolt: Optimize lot calculation and margin clamping
- Pre-calculate inverse of initial margin in OnInit to avoid division in hot path.
- Refactor CalculateLots to apply margin clamping before normalization.
- Consolidate rounding and clamping logic into a single execution path.
- Remove redundant NormalizeDouble and duplicate calculations.
2026-02-08 19:20:35 +00:00
google-labs-jules[bot]
39a12f19fd bolt: optimize OnTick execution and data retrieval in EA
This commit implements several performance optimizations in the SMC_TrendBreakout_MTF_EA.mq5 Expert Advisor:

1.  **Early Exit for Open Positions**: Moved the PositionSelect check to the top of the OnTick handler, immediately after the new bar check. This skips expensive indicator data fetching (CopyRates, CopyBuffer) when a position is already open.
2.  **Minimized Data Payload**: Reduced the number of bars fetched from 3 to 2 for CopyRates and all CopyBuffer calls. The current strategy logic only requires the current and previous bars.
3.  **Lazy Evaluation of Prices and Indicators**: Deferred SymbolInfoTick and ATR fetching until a trade signal is confirmed.
4.  **Atomic Price Retrieval**: Replaced non-standard Ask/Bid variables with SymbolInfoTick for more efficient and robust price retrieval in MQL5.

These changes significantly reduce terminal overhead and data transfer per tick, particularly improving performance during optimization and backtesting.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-01 17:22:31 +00:00
google-labs-jules[bot]
cee78864d6 Bolt: optimize indicator OnCalculate performance (revised)
This commit implements several performance optimizations in the SMC MTF indicator:
1. Robust Early Exit: Added a 'new bar' check using iTime() to skip redundant calculations on every price tick. Handled prev_calculated=0 to ensure full history recalculations when requested.
2. Lazy Loading: Wrapped expensive fractal and Donchian calculations in conditional blocks so they only execute if the respective features are enabled.
3. Efficient Buffer Clearing: Replaced manual O(N) loops with ArrayInitialize() for bulk clearing of indicator buffers on first run.
4. Robustness: Added 'history not ready' checks (iTime == 0) to both the indicator and EA.
5. Cleanup: Removed redundant ArraySetAsSeries calls on static arrays in GetMTFDir and updated comments.

Impact: Reduces CPU usage on every tick by skipping unnecessary logic and improves initialization speed during history loading.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-01-31 10:52:36 +00:00
Cursor Agent
3ddc5c633b Merge main into feature branch, resolve conflicts
Co-authored-by: lengkundee01 <lengkundee01@gmail.com>
2026-01-30 19:52:47 +00:00
google-labs-jules[bot]
80466584ba Bolt: Use native ArrayMaximum/ArrayMinimum for Donchian calculation
💡 What: Replaced manual `for` loops in `HighestHigh` and `LowestLow` with native `ArrayMaximum` and `ArrayMinimum` functions in `mt5/MQL5/Indicators/SMC_TrendBreakout_MTF.mq5`.
🎯 Why: Native MQL5 functions are implemented in optimized C++ and are significantly faster than loops executed in the MQL5 scripting layer.
📊 Impact: Improves the performance of Donchian channel calculation, reducing indicator overhead per bar.
🔬 Measurement: Verified with existing CI validation and code inspection.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-01-30 17:33:07 +00:00
google-labs-jules[bot]
ac7d690440 Bolt: use native ArrayMaximum/ArrayMinimum in indicator
Replaced manual loops in HighestHigh and LowestLow functions with native MQL5 ArrayMaximum and ArrayMinimum functions in mt5/MQL5/Indicators/SMC_TrendBreakout_MTF.mq5.

What: Replaced MQL5 script-level iterative loops with native C++ implemented functions for finding extreme values in price arrays.
Why: Native MQL5 functions are significantly faster than manual loops as they are executed in compiled C++.
Impact: Reduces execution time for indicator calculations on every new bar, improving overall EA performance during backtesting and live trading.
Measurement: MQL5 documentation confirms native functions are optimized for performance. The code now includes safety checks for the -1 return value.

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-01-30 17:09:28 +00:00
NUNA
5aeb1cfa35 Add dev container setup, cloud deployment configs, and Jules deployment automation 2026-01-19 09:53:30 +07:00
google-labs-jules[bot]
3fe2d901ee
fix(MQL5): Correct off-by-one error in Donchian lookback (#87)
This commit corrects a subtle off-by-one error in the array boundary check for the Donchian channel lookback period.

The original condition `if(donStart + donCount >= needBars)` would incorrectly cause an early exit if the required number of bars for the lookback precisely matched the number of available bars in the array. This prevented valid signals from being processed at the edge of the dataset.

The condition has been changed to `if(donStart + donCount > needBars)`, which is the correct boundary check. This ensures the calculation proceeds when exactly enough data is available and only exits if there is insufficient data, improving the EA's robustness.

This issue was identified during a code review for a separate performance optimization attempt.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-01-11 02:10:59 +07:00
google-labs-jules[bot]
4d34289b02 feat(perf): Cache MTF confirmation to reduce redundant calculations
Implements a caching mechanism for the multi-timeframe (MTF) trend confirmation in `GetMTFDir`.

The trend direction from the lower timeframe is now calculated only when a new bar forms on that timeframe, instead of on every tick of the main chart. The result is cached and returned on subsequent calls until the next lower timeframe bar appears.

This avoids expensive and redundant `CopyBuffer` calls, significantly improving the EA's performance and efficiency, especially when the signal timeframe is much shorter than the confirmation timeframe. Logic was carefully updated to read from the last *completed* bar to prevent any change in trading behavior.
2026-01-07 10:37:51 +00:00