Automating Strategy Selection with Python Clustering in MQL5
Article MQL5 articles
Summary
This installment explains how to add a clustering step to an automated workflow for selecting groups of trading strategy instances. It uses K-means from scikit-learn to cluster results from the first optimization stage, then excludes same-cluster instances when forming a group in the next stage. The author chooses to launch a Python program from MQL5 through an operating-system call, rather than building clustering in MQL5 or adding a web service.
Key ideas
- The workflow inserts a clustering stage between two existing optimization stages.
- K-means assigns clusters to strategy passes, with pass IDs and cluster labels stored in a separate database table.
- The MQL5 optimization process launches a Python script to read, cluster, and write pass data.
- Database triggers manage task timestamps and create default stage, job, and task records for new projects.
- The article describes implementation and workflow changes, but does not provide enough results to judge how robustly clustering improves strategy selection.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.