Skip to content
All library documents

Preparing Forex Data and Features for a Python Trading Model

Article MQL5 articles

Summary

The article outlines an early data-preparation stage for a machine-learning trading project using EURUSD hourly data retrieved through MetaTrader 5. It describes constructing price and volume features such as moving averages, returns, rolling dispersion, lagged changes, medians, and consecutive directional moves. It then discusses enlarging the dataset through noise, time shifts, scaling, and inversion, followed by labeling observations using trend markers that account for stop-loss and take-profit levels. The remaining workflow includes balancing classes, generating derived features, grouping redundant variables, and ranking features with a random forest.

The article reports that augmentation expanded a stated sample from 150,000 bars to 747,000 rows, and describes a feature-ranking outcome in which opening price and several price-derived features were prominent while automatically generated features were not informative. These are intermediate dataset observations, not evidence of a profitable strategy or a validated predictive model. Synthetic transformations can also alter time-series relationships, and the supplied article does not establish that augmented examples preserve realistic market behavior or prevent leakage. Model selection, validation, and trading-system testing are deferred to later work.

Key ideas

  • Historical EURUSD quotes are retrieved from MetaTrader 5 and transformed into price and volume features.
  • The workflow augments the sample with noise, time shifts, scaling, and inversion.
  • Trend labels incorporate stop-loss and take-profit levels, and class balancing removes redundant examples.
  • Generated features are grouped for redundancy and ranked using a random forest.
  • The reported dataset and feature-selection observations do not demonstrate predictive accuracy or trading profitability.

Tags

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