Edcha: something bad I'm doing with the array and I do not know what it is
Your arrays have zero size, there for fmh[0] and numBar[0] do not exist. You would know that had you looked in the Experts tab.
Error line:
fmh[0]=iHigh(NULL,0,2);
This is the correction needed to set the array size during initialisation:
double fmh[1]; int numBar[1];
This code will increment the arraysize of fmh to 2 when printed:
ArrayInitialize(fmh,EMPTY_VALUE); // empty the chart ArrayInitialize(numBar,EMPTY_VALUE); // empty the chart ResetLastError(); ArrayResize(fmh,2); fmh[0]=iHigh(NULL,0,2); numBar[0]=50; Comment(" BARS "+Bars+ " arraySize "+ArraySize(fmh)+ " Val High"+iHigh(NULL,0,2)); //Report value reading
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am learning MQL4, and I do not know why when I put this code where I assign the value of an array, it takes me out of MT4 and does not print the comment, could you help me please?
double fmh[];
int numBar[];
int start()
{
ArrayInitialize( fmh, EMPTY_VALUE); // empty the chart
ArrayInitialize( numBar, EMPTY_VALUE); // empty the chart
ResetLastError();
fmh[0]=iHigh(NULL,0,2);
numBar[0]=50;
Comment(" BARS "+Bars+
" arraySize "+ArraySize(fmh)+
" Val High" + iHigh(NULL,0,2) ); //Report value reading
}
Could you please help me because something bad I'm doing with the array and I do not know what it is
Thanks.
Edwin Chavarria