Build AI for Generating Quant Trading Strategies in C# (Part 4)

How to export historical price data from MetaTrader 5 to CSVThis is the fourth article in a series of tutorials: Build AI for generating quant trading strategies automatically, you can access the previous article from here:Build AI for Generating Quant…


This content originally appeared on Level Up Coding - Medium and was authored by Besarion Turmanauli

How to export historical price data from MetaTrader 5 to CSV

This is the fourth article in a series of tutorials: Build AI for generating quant trading strategies automatically, you can access the previous article from here:

Build AI for Generating Quant Trading Strategies in C# (Part 3)

Tester class is ready, it will be used by reinforcement learning algorithm later, however, we need to generate data points for the tester.

First, let’s export OHLC price data from MetaTrader 5 trading terminal:

  1. Launch your MT5 terminal, if the Market Watch window is not visible, go to the main menu > View > Market Watch or CTRL+M. It looks like this:

2. Right-click on the instrument of your choice and choose Symbols, a new window will appear:

3. Switch to the Bars tab highlighted on a screenshot above, choose the timeframe, start date, end date, and click Request:

4. Click on the Export Bars button and save the CSV file wherever you want:

As you can see we have candle open date, open price, high price, low price, close price, tick volume, volume (actually we don’t have real volume for Forex pairs, this is why it’s always 0), and spread values to work with, we’ll import and process them in a PriceEngine class in C#, calculating daily OHLC (open, high, low, close) values, some indicator values like RSI, ATR and more.

CSV data’s ready for import, we’ll process this data in the next tutorial.

Thank you and have a great day!


Build AI for Generating Quant Trading Strategies in C# (Part 4) was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Besarion Turmanauli


Print Share Comment Cite Upload Translate Updates
APA

Besarion Turmanauli | Sciencx (2021-04-14T17:30:20+00:00) Build AI for Generating Quant Trading Strategies in C# (Part 4). Retrieved from https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/

MLA
" » Build AI for Generating Quant Trading Strategies in C# (Part 4)." Besarion Turmanauli | Sciencx - Wednesday April 14, 2021, https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/
HARVARD
Besarion Turmanauli | Sciencx Wednesday April 14, 2021 » Build AI for Generating Quant Trading Strategies in C# (Part 4)., viewed ,<https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/>
VANCOUVER
Besarion Turmanauli | Sciencx - » Build AI for Generating Quant Trading Strategies in C# (Part 4). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/
CHICAGO
" » Build AI for Generating Quant Trading Strategies in C# (Part 4)." Besarion Turmanauli | Sciencx - Accessed . https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/
IEEE
" » Build AI for Generating Quant Trading Strategies in C# (Part 4)." Besarion Turmanauli | Sciencx [Online]. Available: https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/. [Accessed: ]
rf:citation
» Build AI for Generating Quant Trading Strategies in C# (Part 4) | Besarion Turmanauli | Sciencx | https://www.scien.cx/2021/04/14/build-ai-for-generating-quant-trading-strategies-in-c-part-4/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.