Forex GPT MA
- Experts
- Evgeniy Kuzevanov
- Version: 1.1
- Activations: 5
This advisor independently creates a neural network and is trained during operation or when launched in the strategy tester; the network is created from the average price values (based on the Moving Average indicator).
See my profile for my other products.
The advisor does not use third-party libraries, does not connect anything, all calculations occur inside the advisor, with the ability to save neural network data and all its parameters when training, restarting or transferring to another terminal using files created during its operation!
1. Basic principle of operation.
2. Construction of a neural network.
3. Checking neural network options.
4. Block for opening and calculating virtual orders.
5. Filter for analyzing and selecting virtual orders.
6. Description of input parameters.
1. Basic operating principle.
This advisor uses and creates a neural network in its work using the average price values. For the average price we use the Moving Average indicator. On each new bar, the advisor builds a grid of cells based on past data, checking whether the cell contains an average price. To build a network, we use the x and y coordinate axis; when the average price is in a cell, it writes - 1 into it; if there is no price, then - 0. In this way, a variant of the network is formed, and this happens on each new bar, then the adviser checks it in its neural network Is there such a location option and if not, then it adds this option to the network and gives a signal to open virtual orders, and if it already exists, then the virtual order calculation block begins to open virtual orders and track price changes and records either profit or loss for each option which is on the net. Thus, the advisor virtually calculates each option and accumulates the history of transactions for each option of the neural network.
Next, virtual orders are filtered by 3 filters and, when the criteria are reached and signals from the network are available, they are placed into trading. When this option is enabled, the advisor can save all work data to files for learning from history or for transferring to another terminal.
2. Construction of a neural network.
To understand how the advisor builds its neural network, let’s look at picture No. 1 https://c.mql5.com/31/1112/forex-gpt-ma-screen-2118.jpg :
So we see a price chart with the Moving Average indicator with the value period=2 and a lined grid (red lines) of network cells. Along the X axis we take bars, which can be used in steps or each bar, in the figure step=4 is used. Along the Y axis we take values from the opening price of the current bar, build a grid upward by adding delta, and downward by subtracting delta.
It turns out like this: the advisor looks at the current bar and if there are values of the Moving Average indicator in the cell, then the advisor writes 1 to this cell, if there is no value of the Moving Average indicator there, then writes 0.
The construction of the network proceeds from the upper left cell from left to right down row by line, when the advisor option Filesave=true is enabled, the data of the neural network is written to the file row by row, each line in the file is a version of the network rectified into one line in the order of its construction - the upper left cell from left to right down picture No. 2 https://c.mql5.com/31/1112/forex-gpt-ma-screen-3578.png .
In this figure, the contents of the *_neural.csv file stores variants of the neural network; each line is 1 variant of the neural network with values 0 and 1.
In this case, this is the formation of a network x=4 y=11 and delta=70, to see visually you need to break the 1st line by x=4 y=11 – picture No. 3: https://c.mql5.com/31/ 1112/forex-gpt-ma-screen-6086.png
The same can be seen in the enabled information panel mode Enable panel=true
This example clearly shows how a network is formed from x=4 y=11 and step=1 – picture No. 4: https://c.mql5.com/31/1112/forex-gpt-ma-screen-1840.png
Bars are formed like this from right to left 0,1,2,3 and on the network the right column in the middle costs 1, then the second column in the middle also costs 1 and in the 3rd column 1 costs higher than the 1 that were before, because the price there is higher than them and in the left column 1 is even lower than those units since the price there was lower than those values.
This is how a neural network is formed, which is stored as an array of data in the advisor’s memory and, with the Filesave=true option enabled, is uploaded every Monday to the MQL4/files/ files when trading and when testing in tester/files/.
3. Checking neural network options.
After 1 variant of the neural network has been formed, the advisor monitors the new network variant on each new bar, if it differs from what already exists, the advisor adds it to its database while opening virtual orders in both directions, thus the advisor tracks both sell and buy for each network option, and then, when analyzing which sell or buy option will have a good rating, he will trade. At each bar, the advisor checks, as if building a network, and looks at how the indicator is located there and, in accordance with this, makes a decision; if there is no such option, then it adds, if there is, it opens virtual orders. This continues while the advisor is working.
4. Block for opening and calculating virtual orders.
The advisor implements a mechanism for opening and analyzing already open virtual orders. Using arrays of variables, the advisor tracks signals from the neural network block and, upon receipt, begins to monitor how the price changes with each bar, using the values of the 1st bar open, high, low, close. Taking into account the direction of trade, the block calculates the profit of each order and calculates each network option. The calculations use the values of maximum profit and minimum for drawdown, profit factor, profit and loss, and the number of orders for each network option. Thus, if there are 20 options in the neural network, then in the block of virtual orders there will be 20 options for the variables SL, TP, PF, DD, ordercount for sell and the same values for buy. All these values are stored in the EA’s memory as an array of data; when the Filesave=true option is enabled, the EA uploads these values to the following files: MQL4/files/ when trading and when testing in tester/files/:
*_buy_d1_v1.csv, *_buy_d1_v2.csv and their copies just in case.
*_sell_d1_v1.csv, *_ sell _d1_v2.csv and their copies just in case.
Each line is the values of SL, TP, PF, DD, ordercount for one network option. (see picture picture No. 5: https://c.mql5.com/31/1112/forex-gpt-ma-screen-3958.png )
*_data.csv – information about the upload date, the number of network options and how much profit by filters is written here, the overall balance. Using this file, we are guided from what date to what date the adviser has accumulated history for restarting or when transferring after training on history.
5. Filter for analyzing and selecting virtual orders.
All network options are considered virtual orders. Despite the fact that each network option keeps statistics on two directions of trade at once, both buy and sell. All values can be good and bad, unprofitable and positive; to find the best options, a filter is made that selects the best from all values according to a certain criterion. 3 types of filtering are implemented:
The following calculations are used for filters:
Filtr1 - By maximum profit.
Filtr2 - By maximum profit*profit factor.
Filtr3 - By maximum profit*profit factor*number of orders.
Each filter can be turned on and off; when the filters are turned on, it is possible to open 3 orders at once.
6. Input parameters
Magicnumber - number to identify your orders;
Lot - Lot size;
On/off MM - enable or disable money management;
Risk % - Percentage of the deposit for MM;
Enable Panel - Enable the information panel;
panel fon Color - Background color of the information panel;
panel text Color - Information panel text color;
breakeven on/off - enable breakeven;
breakeven distance - distance to switch on for transferring SL to +;
breakeven pips - how many points to set SL to +;
ON or OFF Trailing - enable trailing stop;
MinProfit for Trailing - distance for enabling the transfer of SL to +;
TrailingStop - how many points to set SL to +;
TrailingStep - how many points to move SL to +;
Filesave - When enabled, the advisor will save all parameters to files in *.scv format - when testing, in the terminal folder tester/files/folder with advisor parameters/filename*.scv. When trading in the MQL4 terminal folder/Files/ folder with advisor parameters/filename*.scv
Filename - file names for saving information: Filename_buy.csv, Filename_buy_copy.scv, Filename_sell.csv, Filename_sell_copy.scv, Filename_data.csv, Filename_data_copy.scv, Filename _neural .csv, Filename _neural _copy.scv;
PF - minimum profit factor value for filtering virtual orders;
MA - period of the Moving Average indicator for determining the neural network;
SL* - Stop Loss value - 16 calculation options;
TP* - Take Profit value - 16 calculation options;
k_sl_tp - coefficient for multiplying SL TP values;
delta - range of price values in points to form a network along the Y axis;
step - step in bars to form a network along the X axis;
Input net_x - number of cells along the X axis;
Input net_y - number of cells along the Y axis;
profittestmax - minimum profit for virtual orders to start opening real orders;
dd_max - maximum drawdown for virtual orders, more than which will not be filtered for selection for real trading;
NumberOfTry - number of attempts to open and modify orders;
Slippage - slippage;
Result:
After the virtual orders have been filtered, there is another option: profittestmax, where the profit is indicated in the deposit currency, for example it costs 50, which means real trading will begin only when the profit of virtual orders for the network options exceeds these values.
It turns out that the advisor seems to be optimizing the parameters himself, calculating all the SL TP options and selecting the best options from them and then toruget based on them.
When the Filesave=true option is enabled, files are written once a week - on Monday morning.
If you ask why the network consists only of a maximum of x=4 and y=13, then the answer is: the larger the size of the network, the more options it has that will be less repeated in history and therefore there will be little statistics on them, this also increases resources and time computer operation for searching and training the network, and there is another important parameter: the possibility of storing variables is also not unlimited and is limited by the capabilities of the MQL4 programming language. With huge amounts of testing and optimization, the maximum parameters were left exactly x=4 and y=13.