Skip to content
All library documents

A CatBoost Trading Classifier with Random-Horizon Labels

Article MQL5 articles

Summary

This article demonstrates a basic CatBoost workflow for building a directional trading classifier. It derives lagged features from deviations of closing prices from a moving average, then assigns buy or sell labels according to whether price rises or falls over a randomly chosen future holding period. The author describes splitting data into training and validation samples, fitting the classifier, testing signals in a custom simulator with a spread allowance, and transferring the model into MetaTrader.

The examples use hourly EURUSD data and show that the model’s apparent performance on the development sample deteriorates substantially on unseen data. The article presents this as a limitation of its naive design: random label horizons create variable training targets, the model has no prior market structure, and the training process offers little assurance about behavior in new regimes. It proposes selecting models against external performance criteria, changing the sampling and training process, and adding features grounded in domain knowledge. The results are educational, not evidence of a robust live strategy; validation, costs, and generalization remain central concerns.

Key ideas

  • The feature set consists of lagged deviations from a moving average.
  • Labels encode the direction of price change over randomly selected future horizons.
  • A custom tester reverses positions when the model’s predicted class changes and can include spread costs.
  • The article reports materially weaker performance on new data than on the development sample.
  • Domain-informed features and model selection on external data are suggested as possible improvements.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.