today I started my first project in MQL5 and right at the beginning I'm very frustrated, yet.
I wanted to draw some lines at prices from an array. I never had problems with arrays, but in MQL5 I don't get it working.
For any reason I get the error message "array out of range" and the EA will get removed. Where is my mistake? :/
At the top:
input int VolPeriod= 14;
input int VolRatio = 3;
input int GridSize = 10;
And the function:
double vUG = SymbolInfoDouble(Symbol(),SYMBOL_BID)+GridIncrement*(i+1);
double vDG = SymbolInfoDouble(Symbol(),SYMBOL_BID)-GridIncrement*(i+1);
I also tried the normal way 'UpGrid[i] = value;' instead of ArrayFill, but that also won't work.
Would be very happy if anyone could solve the problem.
You have a bug in ArrayFill function. Third param is number of elements to fill so this should be 1 in this case:
Normal way also should works properly:
UpGrid[i] = vUG;
DownGrid[i] = vDG;