Download Market Data through API?

 
Hi! I am slightly new in MetaTrader5, and I wanted to know if it is possible to download market data using an API. I am currently doing it manually using the desktop app, but I wanted to know if it can be done through a script or something. More specifically I am interested in downloading the bars data. Thanks! 
 
Suraj Rohira: Hi! I am slightly new in MetaTrader5, and I wanted to know if it is possible to download market data using an API. I am currently doing it manually using the desktop app, but I wanted to know if it can be done through a script or something. More specifically I am interested in downloading the bars data. Thanks! 

You can code a MQL5 program to download the Bar or Tick data — Documentation on MQL5: Timeseries and Indicators Access

You can also use the Python API as well — Documentation on MQL5: Integration / MetaTrader for Python

 
Fernando Carreiro #:

You you can code MQL5 programs to download the Bar or Tick data — Documentation on MQL5: Timeseries and Indicators Access

You can also use the Python API as well — Documentation on MQL5: Integration / MetaTrader for Python


Great, I'll give it a go. Thanks!

 
Suraj Rohira #: Great, I'll give it a go. Thanks!
You are welcome!
 
Fernando Carreiro #:
You are welcome!
One more question, I have a basic script that downloads the historical data. Would it be possible to run this script from a C# application? For example, connect to MetaTrader5 through the C# app, and then run the script.
 
Suraj Rohira #: One more question, I have a basic script that downloads the historical data. Would it be possible to run this script from a C# application? For example, connect to MetaTrader5 through the C# app, and then run the script.

You say you have a "script". What script and in what language?

 
Fernando Carreiro #:

You say you have a "script". What script and in what language?

It is a MQL5 script
 
Suraj Rohira #: It is a MQL5 script

Then no! MQL5 scripts can only run on MetaTrader. You can however call MetaTrader from a command line batch file with a startup configuration file to run an MQL program.

Reason: