Box-Constrained Truncated Newton Optimization and Logistic Regression in MQL5
Summary
This article describes an MQL5 implementation of the truncated Newton conjugate-gradient method for minimizing functions with or without box constraints. Rather than construct and store a full Hessian, the method uses an inner conjugate-gradient process and Hessian-vector products estimated through finite differences of the gradient. The API allows users to supply an analytical gradient or rely on numerical differentiation, configure bounds and stopping criteria, run optimization, and retrieve the solution and diagnostics.
The implementation is demonstrated on the Rosenbrock benchmark, whose narrow valley makes convergence challenging, and in a logistic regression example as an alternative to LBFGS. These examples show how the optimizer can be integrated and exercised; the article does not provide a broad benchmark across problem classes or evidence about predictive trading performance. Results will depend on objective scaling, derivative quality, bounds, and optimizer settings. The method is presented as a general numerical optimization tool for MQL5 developers, not as a trading strategy.
Key ideas
- Truncated Newton conjugate-gradient approximates second-order optimization without explicitly forming a full Hessian.
- The optimizer supports box constraints and either callable analytical gradients or numerical differentiation.
- Configuration includes bounds, evaluation limits, line-search settings, and convergence tolerances.
- The article demonstrates the implementation on the Rosenbrock function and a logistic regression task.
- These examples validate use cases but do not establish trading performance or broad superiority to LBFGS.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.