# Neural networks for the Trading Robots Creation

Friday, 2 February 2018 12:22Neural networks are an attempt of scientists to recreate the work of the human brain artificially. Traders are actively interested in this area of research. It's not surprisingly. Who would abandon the self-learning trading robot, which is able to independently adjust to the changing market conditions and develop profitable trading strategies?

Traders with experience in programming try to apply the principles of the neural networks' work in practice. Some of them even achieved some success in this regard. However, for most market participants, the concept of "neural networks" is utterly incomprehensible. In this article, we will try to understand how neural networks are constructed and how the trading robots developed on their basis work.

## What are neural networks?

Neural networks are an important part of research in the field of artificial intelligence (AI), which is aimed at creating a robot that thinks like a person. It is logical that the neural network consists of neurons. In terms of anatomy, neurons are nerve cells that permeate the entire human body. They perceive and transmit information to the brain, which, depending on the received signal, takes an appropriate decision and instructs the organs to react in a certain way.

The work of modern computers is based on these principles: a signal comes from the external environment, processed by mathematical calculations, and depending on the embedded algorithm, the program responds appropriately. However, unlike the human brain, such a robot cannot independently learn or adapt to environmental changes. All its reactions are patterned, and if some algorithm is not provided for the source code, the program will fail. Artificial neural networks are designed to eliminate this deficiency and compel robots to think like a human.

### The structure of the robot based on the neural network

The neuron, as the basic element of the human nervous system, consists of several parts:

- Dendrite collects information about the environment from receptors or other neurons;
- Soma is the body of the nerve cell. This part of the neuron converts the signals through the complex of biochemical processes;
- Axon is a process of the neuron that transmits information to other nerve cells.

Developers of trading robots try to realize all the properties of the neuron components in the form of mathematical models. One such model is the summation of incoming signals multiplied by the weight coefficients, which are transformed in a certain way by a transfer function in accordance with the market conditions changes. As a result of the calculations, an output signal is generated, which forces the robot to react in a certain way — to open and close the trading positions.

Mathematically, the structure of a neuron is as follows:

Where:

- Xn - input signals;
- Wn - weight coefficients;
- NET - summation result;
- F (x) - activation function;
- Out - output signal.

The results of the calculations are transformed by the activation function F(x) and take the form of the output signals.

An artificial neuron cannot simultaneously combine all the functions of the human nerve cell. So, the structure of a trading robot based on a neural network consists of several successively located layers:

- Input layer consists of neurons performed data distribution on the network, but do not perform any calculations.
- Hidden layers contain neurons that perform calculations. According to the results of the calculations, the signals for building the logic of the trading adviser's work are generated. The hidden layer can be an unlimited number.
- Output layer consists of ordinary neurons that receive a signal from the hidden layers and transmit it output.

### Training of the neural networks

The main advantage of the neural networks is their ability to learn. The essence of training consists in changing the weight coefficients depending on the incoming signals. A trading robot based on the neural network can be learned independently, if market conditions change in a favorable direction. In this case, the neural network determines the patterns in the incoming data and itself adapts to them.

However, in order to adapt the neural network to situations where the price of an asset changes to a disadvantageous direction, it is necessary to "train" it or to optimize the weight coefficients. In the role of "teacher" is usually a change in price after the transaction making in conjunction with other parameters (timeframe, interval, trading mode, etc.).

The results of training the robot can be traced using the strategy tester in MetaTrader 4. As a rule, even the simplest trading advisors based on the neural networks give a good result.

Share