Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

MTC Сombo - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 3 reads | 0 comments |

The following is the author's description with slight modifications by me since currency pairs now use five digits.

Let's say we have a basic trading system ( base station ). We should design and train a neural network ( neural network ) so that it can complement the BTS by performing operations that are inaccessible to the BTS. From this, we will get a trading system composed of two combined and complementary components of BTS and NN.

Since the wheel has been invented, there is no need to reinvent the wheel. If there are cars, teach anyone to run fast. If there are helicopters, what is the point of teaching anyone to fly?

If we have a trend TS, we simply teach the neural network a counter-trend strategy. Systems used for trends cannot trade during consolidation and cannot adequately define retracements and reversals. Of course, we can use two trading strategies (trend and countertrend strategies) and launch them on a single chart. On the other hand, we can train neural networks to complement our trading systems.

To this end, we develop a two-layer neural network consisting of two bottom-layer perceptrons and one upper-layer perceptron.
A neural network may be in one of three states:

The training of neural network is divided into three stages. Each perceptron trains a perceptron. An optimized BTS exists at each stage to let the perceptron know what it can do.

Separate training of the perceptron using a genetic algorithm is due to the disadvantage of this algorithm, namely the limited number of parameters that can be selected with its help. Regardless, each training stage is logically consistent and the neural network is not too large, so the entire optimization process occurs in a reasonable amount of time.

But the first stage before neural network training is for BTS optimization.

To avoid confusion, phase numbers are used in EA inputs with " passed " IDs. The input ID corresponding to the stage number ends with that exact number.

Let's make preliminary preparations for NN optimization and training .

Set the initial deposit in the tester to $100 (do not create artificial margin calls during the optimization process), optimize the " Balance + Max Sharpe Ratio " range, " Fast Genetic Algorithm " optimization type. 

Now, go to the Inputs tab of the EA properties.
Set the lot size of open positions by assigning the value 0.01 to the “ lot ” ID.

Optimization should be based on a " disclosed price only " model. This method was chosen because of its speed. In addition, the EA algorithm has new bar management features.

The first optimization stage. Base station optimization:

Set channel to 1.
Only all inputs corresponding to the first stage whose ID ends with 1 are optimized. Therefore, setting optimization flags on them only removes the flags from the remaining parameters.

tp1 - BTS took profits. Optimize using values ​​from 100 to 1000 in steps of 10
sl1 - BTS Stop Loss. Optimize using values ​​from 100 to 1000 in steps of 10
p1 - ​​Period of the CCI oscillator used in BTS. Optimize using values ​​from 3 to 100 in steps of 1

Start training with genetic algorithm optimization.

The second stage. Train a perceptron responsible for short positions:

Set the "pass" input to 2 (to match the stage number).
Remove the optimization flags set in the previous stage. Save the input obtained in the previous stage to a file, just in case.

Set the optimization flag for the second stage parameters (ID ends with 2):

x12, x22, x32, x42 - the weight ratio at which the perceptron identifies short positions. Optimize using values ​​from 0 to 200 in steps of 1.
tp2 - profit from the position opened by the perceptron. Optimize using values ​​from 100 to 1000 in steps of 10
sl2 - stop loss for positions opened by the sensor. Optimize using values ​​from 100 to 1000 in steps of 10
p2 - the period of the price difference value analyzed by the perceptron. Optimize using values ​​from 3 to 100 in steps of 1.

Start training with genetic algorithm optimization.

The third stage. Train a perceptron responsible for long positions:

Set the "pass" input to 3 (to match the stage number).
Remove the optimization flags set in the previous stage.
Save the input obtained in the previous stage to a file, just in case.

Set the optimization flag for the third stage parameters (ID ends with 3):

x13, x23, x33, x43 - the weight ratio at which the perceptron identifies long positions. Optimize using values ​​from 0 to 200 in steps of 1.
tp3 - Profit from the position opened by the perceptron. Optimize using values ​​from 100 to 1000 in steps of 10
sl3 - Stop loss for positions opened by the sensor. Optimize using values ​​from 100 to 1000 in steps of 10
p3 - the period of the price difference value analyzed by the perceptron. Optimize using values ​​from 3 to 100 in steps of 1.

Start training with genetic algorithm optimization.

The final fourth stage.

Training the first layer (upper layer perceptron):

Set the "pass" input to 4 (to match the stage number).
Remove the optimization flags set in the previous stage.
Save the input obtained in the previous stage to a file, just in case.

Set the optimization flag for the fourth stage parameters (ID ends with four):

x14, x24, x34, x44 - The weight ratio of the first layer perceptron. Optimize using values ​​from 0 to 200 in steps of 1.
p4 - the period of the price difference value analyzed by the perceptron. Optimize using values ​​from 3 to 100 in steps of 1.

Start training with genetic algorithm optimization.

That's all. The neural network has been trained.

This EA also has another non-optimizable "mn" input - a magic number that allows the system to distinguish its own orders among those opened manually or by other EAs. Magic numbers should be unique.


Attachment download

📎 mtc_7ombo_v2.mq5 (26.24 KB)

Source: MQL5 #16762

Verification code Refresh