When the EA is started, it is started briefly, but deleted again at the same moment. The error is as follows: array
out of range in "DeepFeedForward.mqh" (94,25) (DeepFeedForward --> that is the MQH file)
The line that triggered this error is highlighted below, so the array indices (i.e. i, j or k) used to access the arrays (i.e. abWeights[][] or weights[]) must have gone out of range:
for(int i=0; i<numHiddenA;++i) for(int j=0; j<numHiddenB;++j) abWeights[i][j]=NormalizeDouble(weights[k++],2);
If you check the sizes of abWeights[][] and weights[], they are [5][5] and [107] at the time of crash, which means that the problem is due to j reaching the value of 5 (because you are iterating it from 0 to 5 (since numHiddenB is 6)).
The line that triggered this error is highlighted below, so the array indices (i.e. i, j or k) used to access the arrays (i.e. abWeights[][] or weights[]) must have gone out of range:
If you check the sizes of abWeights[][] and weights[], they are [5][5] and [107] at the time of crash, which means that the problem is due to j reaching the value of 5 (because you are iterating it from 0 to 5 (since numHiddenB is 6)).
Although I've learned a lot about arrays from your answer, I still haven't come to a green branch yet.
Do you have any idea what I need to change to take the value 6?
You would help me a lot with that!
Thanks a lot, as you recognized correctly, the error disappears when I set NumHiddenB to the value 5. Unfortunately, this doesn't really solve my problem, because the value must be 6.
Although I've learned a lot about arrays from your answer, I still haven't come to a green branch yet.
Do you have any idea what I need to change to take the value 6?
You would help me a lot with that!
I looked through the codes again, and I noticed that it won't run even if the array is fixed to take the 6th value, because another array - _xValues[] - while being used for computation, was never filled with any data.
So my suggestion is, if you can describe the execution logic that you're after, go to the freelance section and get someone to add in whatever functions that are obviously missing. Or else fixing the array index won't get you anywhere.
Thanks a lot, as you recognized correctly, the error disappears when I set NumHiddenB to the value 5. Unfortunately, this doesn't really solve my problem, because the value must be 6.
Although I've learned a lot about arrays from your answer, I still haven't come to a green branch yet.
Do you have any idea what I need to change to take the value 6?
You would help me a lot with that!
Your problem is a bad design, you are using an hardcoded value to declare your array then a variable with a different value to loop through it.
You are using a macro to declare the size of your array :
double abWeights[][SIZEA]; //Weights HiddenA to HiddenB
SIZEA is hardcoded as :
#define SIZEA 5
So indexes for abWeights[] is from 0 to 4. But the you are using a variable numHiddenB to loop through the second dimension of your array :
int numHiddenB = 6; ... for(int i=0; i<numHiddenA;++i) for(int j=0; j<numHiddenB;++j) abWeights[i][j]=NormalizeDouble(weights[k++],2);
By the way - although it wasn't your question: if you initialize all weights and biases with 1.0 the network will never learn anything. You need to assign a random value, e.g. using something like weight[i]=MathRand()/32767. Then initializing weights and biases is a very simple loop in just a few lines of code and it has more flexibility that way instead of hardcoding like you do.
The principle during backpropagation of a neural network is computing back the error between output result and correct (label) result and then correcting the weights via giving a "penalty" depending on how much an individual weight contributed to the overall error. This way the overall error (expressed by the cost function) will hopefully step by step reach a minimum.
If all weights are the same, they will be corrected always by the same amount (=same "penalty") and the weight matrix won't learn anything.
Please feel free to ask if there's anything you don't understand.
Chris.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello together
When the EA is started, it is started briefly, but deleted again at the same moment. The error is as follows: array out of range in "DeepFeedForward.mqh" (94,25) (DeepFeedForward --> that is the MQH file)
Unfortunately I am still a beginner in coding. I would be really happy if someone could help me with this problem. It seems to me that the error occurs in the MQH file.
The Expert Advisor is not finished yet, so some lines might seem a bit bizarre!
Thank you in advance for the help.
MQH File:
EA: