Skip to content
All library documents

Machine Learning Labels for Trend-Following Strategies

Article MQL5 articles

Summary

The article describes ways to label historical data for machine-learning trend strategies. Its basic method smooths closing prices with a Savitzky–Golay filter, estimates trend direction from the smoothed series, and normalizes the gradient by rolling price volatility. Positive and negative values beyond a threshold become buy and sell labels; weaker or unclear readings are treated as no signal. It also proposes labeling only trades that reach a chosen profit markup within a randomly selected future-bar range, and comparing alternative smoothing filters.

The article places these labels within a broader clustering and classification workflow and discusses experiments on EURUSD. It reports that reducing model complexity produced a noisier, more uniform equity curve, and that trend models had difficulty generalizing when prices moved beyond the training range. Profit-based labels depend on future prices and selected thresholds, so they require careful separation from model inputs to avoid look-ahead leakage. The reported experiments are not sufficient to establish robust out-of-sample performance.

Key ideas

  • A smoothed-price gradient can define trend direction, with rolling volatility used to normalize its magnitude.
  • A threshold can exclude weak or ambiguous trend observations from buy and sell labels.
  • Profit-filtered labels retain only signals that reach a specified markup within a selected future horizon.
  • The author experiments with multiple smoothing filters and a clustering and classification workflow.
  • Reported generalization difficulties include market prices moving outside the training range.

Tags

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