Discussing the article: "Self-Optimizing Expert Advisors in MQL5 (Part 19): Parameter Optimization For Time-Lagged Independent Components Analysis (2)"

 

Check out the new article: Self-Optimizing Expert Advisors in MQL5 (Part 19): Parameter Optimization For Time-Lagged Independent Components Analysis (2).

The article shows how to tune ICA hyperparameters with a supervised evaluation pipeline and apply spectral clustering to time-lagged indicators. Cross-validation identifies the optimal number of clusters, which are translated into expected return and risk measures. These signals drive dynamic position sizing and stop-loss control, with surrogate models converted to ONNX and integrated into an MQL5 Expert Advisor.

This article addresses a practical engineering problem: how to suppress statistical noise in lagged market features and turn the resulting structure into a reproducible, deployable risk-aware trading application for MQL5. Our starting point is a simple pipeline that computes moving‑average (MA) lagged features, learns an ICA embedding, and feeds that embedding into a linear classifier. In practice, we observed two failure modes:

  • The ICA parameters and the manifold-based clusters did not reliably improve out-of-sample trading performance
  • Direct deployment of spectral clustering in MQL5 is challenging because the current skl2onnx converter does not support scikit-learn clustering objects.

To address these issues we set three explicit objectives:

  • Select ICA parameters that maximize predictive performance under time‑series cross‑validation. 
  • Discover actionable market regimes directly in lagged MA data using spectral clustering and then learn a deployable surrogate for those regimes.
  • Deliver reproducible ONNX artifacts and MQL5 integration so the regimes can drive dynamic position sizing and stop logic. 

Key methodological choices include time‑series CV, a line search on cluster counts, a surrogate multi‑output classifier to bypass ONNX limitations, and careful validation to avoid reward‑hacking on sparse, imbalanced multi‑output labels.

Author: Gamuchirai Zororo Ndawana