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:

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:

2. Right-click on the instrument of your choice and choose Symbols, a…

This is the third article in a series of tutorials: Build AI for generating quant trading strategies automatically, you can check other articles below:

Where are we exactly? Well, we’ve built a basic MetaTrader 5 robot, refined it, and made it more robust following the best practices, which means, in short, that the robot shall perform reasonably well in real market conditions with the least amount of surprises we don’t want.

There are additional data points we can use to improve the logic further but this is not the purpose of this article, that’s what AI shall do, therefore we’ll…

This is the second article in a series of tutorials: Build AI for generating quant trading strategies automatically, you can check other articles below:

We already wrote a basic strategy in Metatrader 5 trading terminal (MQL5 language) and tested it on historical price data, now let’s dive deeper and go through all the best practices for refining and verifying the strategy for reliability. Right now the strategy is very basic, we need more data points and external input parameters to work with, let’s add some of them:

These external input parameters let us change/optimize the strategy settings without modifying…

Let me start with a question: have you ever heard of Citadel LLC, Renaissance Technologies, Two Sigma, or, maybe, D. E. Shaw & Co.? In case you didn’t, the simplest way I can describe what they do is that these companies create automated trading strategies, AKA quantitative strategies, AKA quant strategies, AKA algorithmic strategies that manage investors' money by buying and selling different financial securities (currencies, stocks, indices, commodities, bonds, options, and others) for profit, automatically, without human intervention.

Before computers, there were traders making buy/sell decisions manually by analyzing charts, employing technical (historical price data) and fundamental (macroeconomic data…

Iterating through an object to get its actual values is relatively easy if we know the structure in advance, but for dynamic objects which are generated on-the-fly, we have to also understand their structure on-the-fly.

There are times when objects are built by deserializing JSON strings, for example, and those objects can have any structure, property values could be strings, numbers, other objects, or arrays, we have to first recognize property value type and only then apply relevant action to it: parsing the string/integer/floating value or keep iterating.

To start, let’s create a complex JSON object structure which we’ll convert…

C# is a strongly typed programming language, all the variable types should be defined upon declaration. Also, although C# supports dynamic, modifiable structure objects, this programming language is not as optimized for working with them as PHP or Javascript + Javascript-based frameworks are.

JSON (Javascript Object Notation) itself is a widely used format of communication between different services or programs, especially when it comes to Web-based services and APIs.

Having a function/method or class for handling JSON to object conversions without having to declare the whole object structure and property types preliminarily is a big deal: you don’t always know…


At first, this might seem easy, just find a basic formula online, convert it into a code and run a function on a set of values, right? But in real life, a number of fine and important details come into play that we should always take into consideration, without this, you’ll realize (if you haven’t already) that your values do not always match those in trading terminals or online charts. …

If you have issues with Chrome not syncing your saved passwords and none of the standard checklist items you found on the internet are working for you,

here’s is a simple and easy solution:

Click on 3 dots on your Chrome window (upper right corner) and select Settings, you’ll see the “You and Google” section, like the one below:

Now click on the “Turn off” button (upper right corner), a popup dialog will appear:

Long story short, I had the same problem on my laptop: whenever I connected the external UHD monitor on it via HDMI cable, it was displaying flickering green pixels on some areas of the screen.

I tried everything I found on the internet:

  • Making sure the HDMI cable was clean and well connected;
  • Updating the drivers;
  • Checking/testing the video card for potential issues;
  • Tweaking video settings from GPU control panel and so on..

What’s more interesting, the cable and external monitor was working just fine…

CodeIgniter comes with ready-to-use libraries for almost all standard databases, once you connect your database, you can use standard MySQL queries and query builders so you don’t need to modify your code at all.

Steps to connect CodeIgniter to sqlite3 database

  1. Go to your CodeIgniter directory / application and create a new folder named “db”.
  2. Copy your sqlite3 database file inside this newly created folder.
  3. Go to your CodeIgniter directory / application / config /database.php and modify $db[‘default’] so that it looks exactly like this (you can copy this code and replace there):
$db['default'] = array( 'dsn' => '', 'hostname' => '', 'username' => '', 'password' =>…

Besarion Turmanauli

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store