Introduction

The whole history of mankind is the creation and improvement of tools. From the moment the ancient man took the first stick in his hands, the tools of physical labor have been constantly improved. Alongside constant improvements in tools for physical labor, humans also develop tools for intellectual work.

From the first digital mechanical calculating machine, built by Wilhelm Schickard in 1623, the world of computing machines has evolved to modern computers, which, thanks to developed algorithms, allow us to move from simple calculations to solving other more intellectual tasks. Next, artificial intelligence algorithms emerged and started covering various aspects of our everyday lives. More and more often, news feeds are filled with messages like “The neural network has been taught...”.

The term "artificial intelligence" was first coined by John McCarthy, who gave the following definition:

"Artificial intelligence is the science and engineering of making intelligent machines, especially intelligent computer programs. It is related to the similar task of using computers to understand human intelligence, but AI does not have to confine itself to methods that are biologically observable."

At the same time, the world saw the extensive development of the art of stock trading. In an attempt to predict the future movement of exchange-traded instruments, traders meticulously started charts looking for price movement patterns, developed trading rules, and created trading strategies.

The advent of computing machines has also influenced this area of human activity. The use of computers has allowed more information to be processed in less time. As a result, the analysis of price movements of exchange-traded instruments has become more detailed and in-depth.

Further development has resulted in programs capable of operating according to predefined trading strategies and executing trades 24 hours a day without human intervention.

In this book, we will attempt to combine the above two areas of activity. In this context, another definition of artificial intelligence, as formulated by Andreas Kaplan and Michael Heinlein, would be most appropriate:

"Artificial intelligence is a system's ability to correctly interpret external data, to learn from such data, and to use those learnings to achieve specific goals and tasks through flexible adaptation."

That's the property we're going to exploit. We will look at the basic principles and foundations of artificial intelligence, and then use the widely used MetaTrader 5 terminal and demonstrate its capabilities in building different algorithms for intelligent programs.

On real data, we will test the ability of implemented algorithms to identify patterns, because understanding patterns allows us to determine the most likely vector of development of upcoming events.

We do not consider this book to be a teaching tool on artificial intelligence algorithms. The book gives only basic concepts and principles without delving deeply into the mathematical features of computation and the construction of algorithms.

This work will be more interesting for practitioners. The book provides examples of using different algorithms to solve real-life cases and presents the results of training neural networks built on different architectures using different algorithms.

I would like to draw the attention of all readers to the fact that stock trading is associated with high risks. The responsibility for any trading operation lies with the reader. The book looks at tools, not ready-made trading solutions. To use the provided tools in real trade, additional work is required to build a trading robot and/or indicators for decision-making by the trader, as well as thorough testing.