Discussing the article: "Building Volatility Models in MQL5 (Part III): Implementing the SLSQP Algorithm for Model Estimation"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Building Volatility Models in MQL5 (Part III): Implementing the SLSQP Algorithm for Model Estimation.
An SLSQP optimizer is implemented in MQL5 to resolve parameter discrepancies between a volatility library and Python's ARCH module. The article details constraint handling, gradient options, configuration, and convergence controls and shows how to integrate the solver into existing code. Practical examples and comparisons demonstrate matched log‑likelihoods and parameters on shared datasets.
The volatility library ported to MQL5 throughout this series of articles was designed to replicate the functionality of Python’s ARCH module. Ideally, the MQL5 implementation should produce results that approximate those obtained in Python; however, tests on identical datasets have consistently yielded divergent model parameters. While the objective is not to replicate every decimal place exactly, the parameters must fall within an acceptable range of variance. To address this gap, this installment replaces ALGLIB’s preconditioned augmented Lagrangian algorithm for nonlinearly constrained optimization (minNLC) with the Sequential Least Squares Programming (SLSQP) algorithm.
This article begins by analyzing cross-platform discrepancies to explain why changing optimizers is necessary, specifically by comparing volatility models constructed in Python and MetaTrader 5. We then provide a comprehensive walkthrough of the MQL5-native SLSQP implementation and demonstrate how to integrate this solver into the existing volatility library. Finally, we validate the updated library against its Python counterpart to ensure consistent results. The complete source code is provided for an MQL5 toolset that performs on par with the ARCH module.
Author: Francis Dube