In the first part, I stumbled upon an issue where the algorithm wasn’t digging deep enough to generate the exact source code of the compiled program it was trying to reverse-engineer, so here, we’ll go through the algorithm step-by-step to see what needs to be changed or added in order for it to give us exactly what we need — a 100% accurate result.

By the way, you can check the previous tutorial in case you haven’t seen it already:

If you’re a bit confused as to how linear regression could be applied to reverse engineering compiled programs, seems like…

My relationship with AI began not so long ago. Yes, I heard of it multiple times in movies when I was a child, Terminator, Skynet becoming self-aware and destroying the world… But over time news articles and videos were describing real-life breakthroughs in gaming, self-driving, and other applications.

At some point I realized AI is actually THE unavoidable next thing, not crypto or something else (although crypto will probably have multiple applications and fanbase for years to come)… and not because AI is one of the trendy topics today or because people think it’s cool but because we’ve been moving…

And finally, here it is…

Hi and welcome (again)! In this tutorial, I’m going to reveal the complete source code and principles behind reinforcement learning software able to create and test profitable algorithmic trading strategies automatically.


For the purposes of this tutorial, I’m not a qualified licensed investment advisor, nor do I provide personal investment advice, all information provided in this article (and other articles in this series of tutorials) is for informational and educational purposes only.

Conduct your own due diligence and consult a licensed financial advisor before making any and all investment decisions. Any investments, trades, speculations, or…

Rapid prototyping and validation of additional strategies for smarter AI

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

I did my homework before writing this article and created a reinforcement learning algorithm to replicate all the processes I went through for creating and validating the algorithmic strategy for Metatrader 5.

It makes a little bit better strategy than I do, in a fraction of a time. Although in order to improve the final strategy quality, either I should provide tons of data from…

An in-depth CodeIgniter 3 + SQLite step-by-step tutorial

CodeIgniter has one of the most easy-to-use and thorough documentation among all PHP frameworks and is my personal framework of choice for a variety of other reasons as well.

Today we’re going to create a fully working SQLite database connection in CodeIgniter and do complex interactions with it.

First, open Notepad or any text editor and save a blank file as db.sqlite in [codeigniter_root_directory]/application/databases/ folder. We’ve got our “database” ready.

We now need to open [codeigniter_toor_directory]/application/config/database.php file and modify connection data array, which is by default stored in $db[‘default’] variable:


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:

  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…

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…

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