Skip to content
All library documents

Training a Dueling DQN for XAUUSD and Deploying It in MQL5

Article MQL5 articles

Summary

This article outlines a pipeline for training a reinforcement-learning trading model on hourly XAUUSD data and deploying its predictions in MetaTrader 5. It describes retrieving historical bars, cleaning and preparing the data, creating return and technical-indicator features, and standardizing those inputs. A custom trading environment presents a rolling window of features and lets the agent choose among holding, buying, or selling. The model is trained as a Dueling DQN and exported to ONNX for inference from an MQL5 script.

The article describes cumulative rewards as a way to inspect training progress and explains how the deployed script prepares input data and maps the model output to an action. It does not provide quantitative trading results, a comparison with baselines, or evidence of live profitability. Reproducibility also depends on the data and preprocessing matching between training and deployment; the presented material contains some inconsistent file references and code issues, so implementation details require careful review.

Key ideas

  • Historical XAUUSD bars are transformed into return and technical-indicator features for a reinforcement-learning environment.
  • A Dueling DQN selects among hold, buy, and sell actions using a rolling observation window.
  • The trained model is exported to ONNX and loaded by MQL5 for platform-side inference.
  • Training rewards and successful inference do not by themselves demonstrate trading profitability or robustness.

Tags

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