+
Is this an example for MLP? Did learning get faster with Adam? I remember epochs took a very long time to learn last time around
Stochastic gradient takes a very long time to work, for sure
Thanks for the article.
Are there plans to organise other methods of calculating the learning loss function?
Dmitriy Gizlyk - do you have practice besides bare theory or are you an eternal "teacher"?
practice - is it when with the help of your methods you get successful trading?

- www.mql5.com
Dmitriy Gizlyk - do you have practice besides the bare theory or are you an eternal "teacher"?
practice - is it when with the help of your methods you get successful trading?
Do you want the article to contain a money printing machine?
The man talks about network architecture and variations of its organisation, what is interesting, and what to feed into the network is up to the user.
Question. What are the purposes of creating an enumeration
enum ENUM_BUFFERS
{
WEIGHTS,
DELTA_WEIGHTS,
OUTPUT,
GRADIENT,
FIRST_MOMENTUM,
SECOND_MOMENTUM
};
and variables in the CLayer class?
class CLayer: public CArrayObj { private: ... int hWeights; int hDeltaWeights; int hOutput; int hGradient; ... };
I can't find their use in the code.
Question. For what purposes are transfers created
and variables in the CLayer class?
I can't find their use in the code.
Thanks for pointing that out. You can delete them, they are left over from drafts.
Hi all . who has encountered this error when trying to read a file ?
OnInit - 198 -> Error of reading AUDNZD.......
Hi all . who has encountered this error when trying to read a file ?
OnInit - 198 -> Error of reading AUDNZD.......
This message just informs you that the pre-trained network has not been loaded. If you are running your EA for the first time, it is normal and do not pay attention to the message. If you have already trained the neural network and want to continue training it, then you should check where the error of reading data from the file occurred.
Unfortunately, you did not specify the error code so that we can say more.This message only informs you that the pre-trained network has not been loaded. If you are running your EA for the first time, it is normal and do not pay attention to the message. If you have already trained the neural network and want to continue training it, then you should check where the error of reading data from the file occurred.
Unfortunately, you didn't specify the error code so we can say more.Hello.
I'll tell you more about it.
When launching the Expert Advisor for the first time. With these modifications in the code:
dError=Net.getRecentAverageError(); if(add_loop) { Net.Save(FileName+".nnw",dError,dUndefine,dForecast,dtStudied,false); printf("Era %d -> error %.2 f %% forecast %.2 f",count,dError,dForecast); } ChartScreenShot(0,FileName+IntegerToString(count)+".png",750,400); int h=FileOpen(CSV,FILE_READ|FILE_WRITE|FILE_CSV); if(h!=INVALID_HANDLE) { FileSeek(h,0,SEEK_END); FileWrite(h,eta,count,dError,dUndefine,dForecast); FileFlush(h); FileClose(h); Print("Файл должен быть создан ChartScreenShot "); } else Print("Операция FileOpen ChartScreenShot неудачна, ошибка ",GetLastError()); } }
in the log it writes this :
KO 0 18:49:15.205 Core 1 NZDUSD: load 27 bytes of history data to synchronise at 0:00:00.001
FI 0 18:49:15.205 Core 1 NZDUSD: history synchronized from 2016.01.04 to 2022.06.28
FF 0 18:49:15.205 Core 1 2019.01.01 00:00:00 OnInit - 202 -> Error of reading AUDNZD_PERIOD_D1_ 20Fractal_OCL_Adam 1.nnw prev Net 0
CH 0 18:49:15.205 Core 1 2019.01.01 00:00:00 OpenCL: GPU device 'gfx902' selected
KN 0 18:49:15.205 Core 1 2019.01.01 00:00:00 Era 1 -> error 0.01 % forecast 0.01
QK 0 18:49:15.205 Core 1 2019.01.01 00:00:00 File to be created ChartScreenShot
HH 0 18:49:15.205 Core 1 2019.01.01 00:00:00 Era 2 -> error 0.01 % forecast 0.01
CP 0 18:49:15.205 Core 1 2019.01.01 00:00:00 File to be created ChartScreenShot
PS 2 18:49:19.829 Core 1 disconnected
OL 0 18:49:19.829 Core 1 connection closed
NF 3 18:49:19.829 Tester stopped by user
И в директории "C:\Users\Borys\AppData\Roaming\MetaQuotes\Tester\BA9DEC643240F2BF3709AAEF5784CBBC\Agent-127.0.0.1-3000\MQL5\Files"
This file is created :
Fractal_10000000.csv
#define FileName Symb.Name()+"_"+EnumToString((ENUM_TIMEFRAMES)Period())+"_"+IntegerToString(HistoryBars,3)+StringSubstr(__FILE__,0,StringFind(__FILE__,".",0)) #define CSV "Fractal_"+StringSubstr(DoubleToString(eta),2)+".csv"
with the following contents :
0.1 1 0.006391065067727753 0.30606698779533065 0.009849141883310947 |
0.1 2 0.01416031275898674 0.320172057079727 0.009671500063084178 |
0.1 1 0.021322935369592233 0.4824709164481285 0.009510368103745911 |
0.1 2 0.03047882579179044 0.4736268224037817 0.009336035129387396 |
0.1 1 0.04096262961921367 0.4747386346906194 0.009164897823757697 |
0.1 2 0.04745129346676422 0.9935630387598718 0.1983981648307233 |
and so on...
When restarting, the same error is displayed and the .csv file is overwritten .
That is, the Expert is always in training because it does not find the file.
And the second question, please suggest the code (to read data from the output neuron) to open buy sell orders when the network is trained.
Thanks for the article and for the answer.
Hello.
I'll tell you more about it.
when launching the Expert Advisor for the first time. With these modifications in the code:
in the log it writes this :
KO 0 18:49:15.205 Core 1 NZDUSD: load 27 bytes of history data to synchronise at 0:00:00.001
FI 0 18:49:15.205 Core 1 NZDUSD: history synchronized from 2016.01.04 to 2022.06.28
FF 0 18:49:15.205 Core 1 2019.01.01 00:00:00 OnInit - 202 -> Error of reading AUDNZD_PERIOD_D1_ 20Fractal_OCL_Adam 1.nnw prev Net 0
CH 0 18:49:15.205 Core 1 2019.01.01 00:00:00 OpenCL: GPU device 'gfx902' selected
KN 0 18:49:15.205 Core 1 2019.01.01 00:00:00 Era 1 -> error 0.01 % forecast 0.01
QK 0 18:49:15.205 Core 1 2019.01.01 00:00:00 File to be created ChartScreenShot
HH 0 18:49:15.205 Core 1 2019.01.01 00:00:00 Era 2 -> error 0.01 % forecast 0.01
CP 0 18:49:15.205 Core 1 2019.01.01 00:00:00 A file must be created ChartScreenShot
PS 2 18:49:19.829 Core 1 disconnected
OL 0 18:49:19.829 Core 1 connection closed
NF 3 18:49:19.829 Tester stopped by user
И в директории "C:\Users\Borys\AppData\Roaming\MetaQuotes\Tester\BA9DEC643240F2BF3709AAEF5784CBBC\Agent-127.0.0.1-3000\MQL5\Files"
This file is created :
Fractal_10000000.csv
with these contents :
0.1 1 0.006391065067727753 0.30606698779533065 0.009849141883310947 |
0.1 2 0.01416031275898674 0.320172057079727 0.009671500063084178 |
0.1 1 0.021322935369592233 0.4824709164481285 0.009510368103745911 |
0.1 2 0.03047882579179044 0.4736268224037817 0.009336035129387396 |
0.1 1 0.04096262961921367 0.4747386346906194 0.009164897823757697 |
0.1 2 0.04745129346676422 0.9935630387598718 0.1983981648307233 |
Etc...
When you run it again, the same error is displayed and the .csv file is overwritten .
That is, the Expert Advisor is always in learning because it does not find the file.
And the second question. please suggest the code (for reading data from the output neuron) to open buy sell orders when the network is trained.
Thanks for the article and for the answer.
Good evening, Boris.
You are trying to train a neural network in the strategy tester. I do not recommend you to do that. I certainly do not know what changes you made to the training logic. In the article, the training of the model was organised in a loop. And iterations of the cycle were repeated until the model was fully trained or the EA was stopped. And historical data were immediately loaded into dynamic arrays in full. I used this approach to run the Expert Advisor in real time. The training period was set by an external parameter.
When launching the Expert Advisor in the strategy tester, the learning period specified in the parameters is shifted to the depth of history from the beginning of the testing period. Besides, each agent in the MT5 strategy tester works in its own "sandbox" and saves files in it. Therefore, when you re-run the Expert Advisor in the strategy tester, it does not find the file of the previously trained model.
Try to run the Expert Advisor in real-time mode and check the creation of a file with the extension nnw after the EA stops working. This is the file where your trained model is written.
As for using the model in real trading, you need to pass the current market situation into the parameters of the Net.FeedForward method. And then get the results of the model using the Net.GetResult method. As a result of the latter method, the buffer will contain the results of the model's work.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Neural networks made easy (Part 7): Adaptive optimization methods has been published:
In previous articles, we used stochastic gradient descent to train a neural network using the same learning rate for all neurons within the network. In this article, I propose to look towards adaptive learning methods which enable changing of the learning rate for each neuron. We will also consider the pros and cons of this approach.
Testing of the optimization by the Adam method was performed under the same conditions, that were used in earlier tests: symbol EURUSD, timeframe H1, data of 20 consecutive candlesticks are fed into the network, and training is performed using the history for the last two years. The Fractal_OCL_Adam Expert Advisor has been created for testing. This Expert Advisor was created based on the Fractal_OCL EA by specifying the Adam optimization method when describing the neural network in the OnInit function of the main program.
The number of layers and neurons has not changed.
The Expert Advisor was initialized with random weights ranging from -1 to 1, excluding zero values. During testing, already after the 2nd training epoch, the neural network error stabilized around 30%. As you may remember, when learning by the stochastic gradient descent method, the error stabilized around 42% after the 5th training epoch.
The graph of the missed fractals shows a gradual increase in the value throughout the entire training. However, after 12 training epochs, there is a gradual decrease in the value growth rate. The value was equal to 72.5% after the 14th epoch. When training a similar neural network using the stochastic gradient descent method, the percentage of missing fractals after 10 epochs was 97-100% with different learning rates.
Author: Dmitriy Gizlyk