Using OnCalculate

 

Please find attached an indicator that does nothing but display the values passed to OnCalculate - and a few other values from functions common in indicator development.

Question:  Why, when accessing  volume[] or spread[] do I get an  'index out of range error'?  Are these values not supported in all instances of MQL4?  I'm using FXCM demo account to test, with version 4, build 950.

Files:
 

When you get an arrayout of range error, the error report will tell you in which line of your code that the error occurs.

Please paste that line and block of code here 

 
LukeB:

Please find attached an indicator that does nothing but display the values passed to OnCalculate - and a few other values from functions common in indicator development.

Question:  Why, when accessing  volume[] or spread[] do I get an  'index out of range error'?  Are these values not supported in all instances of MQL4?  I'm using FXCM demo account to test, with version 4, build 950.

 

Not supported (filled) by MT4. It's for compatibility with MT5.
 
GumRai:

When you get an arrayout of range error, the error report will tell you in which line of your code that the error occurs.

Please paste that line and block of code here 

Pretty sure zirkoner's answer is correct.  The lines that produce the errors are commented out in the code supplied, they have = volume[0]; and = spread[0];.  comment the =0; substitutes out, un-comment these and the program crashes.