Skip to content
All library documents

Using JSON APIs to Add Forex Forecast Data to an MQL Expert Advisor

Article MQL5 articles

Summary

This tutorial demonstrates connecting an MQL trading program to an external JSON data service, saving and parsing API responses, and using forecast data as a filter for a moving-average crossover. The example combines a directional moving-average signal with a bullish or bearish forecast threshold before submitting a trade. It also introduces API request and response concepts, MQL WebRequest handling, JSON libraries, and caching responses to avoid unnecessary repeated requests.

The example uses a forex data provider whose fields include market forecasts and other technical, fundamental, and sentiment measures. The article describes the provider’s forecast as aggregating multiple information sources, but supplies no independent evaluation of forecast quality or strategy results. It also offers implementation guidance rather than a controlled backtest; API limits, stale or unavailable data, and the reliability of third-party forecasts are practical dependencies. The method is therefore an integration pattern, not evidence that the filter improves returns.

Key ideas

  • An MQL program can request JSON data from an external service and parse the response for trading logic.
  • The example filters moving-average crossover signals using the forecast direction and a confidence threshold.
  • Saving retrieved data can reduce repeated API requests where request limits apply.
  • The strategy depends on third-party data availability and the reliability of the forecast, neither of which is independently tested in the article.

Tags

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