How it works
There is a basic trading system. This Expert Advisor uses the CCI indicator, if the CCI value is higher than zero, it is a buy, if lower, it is a sell.
The basic system can be wrong. To correct these errors linear perceptrons are used which sometimes take control and ignore the basic trading signals.
The system has three perceptrons one for a sell, one for a buy, the third is the total.
The perceptron exit value can be higher or lower than zero. If both the total perceptron and the first perceptron exit values are negative, a sell opens. If both total perceptron and the second perceptron exit values are positive, then a buy opens. In other cases the basic system signals are used.
The author of the Expert Advisor recommends the following procedure of its setting. There is the pass parameter which can take values from 1 to 4. When 1, the perceptrons are not used, only the basic trading system is set. When pass=1, tp1, sl1, CCIPeriod, CCIPrice parameters should be optimized. Then, when pass=2, configure a sell perceprton when x12, x22, x32, x42, tp2, sl2, p2 parameters are optimized. Then, when pass=3, set a buy perceptron if x13, x23, x33, x43, tp3, sl3, p3 parameters are optimized. At last when pass=4, total perceptron is set and x14, x24, x34, x44, p4 parameters are optimized. The Expert Advisor uses pass=4.
The image shows the results of work of the Expert Advisor in the tester. 1 is optimization results on the image. 2 is forward test results.
Fig. 1. Optimization results.
Fig. 2. Forward test results.
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/1135
The indicator that allows modifying color of the candles.EMA
Classic exponential Moving Average with the ability to use real numbers as the averaging period.