Using OnCalculate

Back to topics list To post a new topic, please log in or register
avatar
10
LukeB 2016.01.25 04:56
 

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.

 

Attached files:
  indicatorexperiment_1.mq4  (17.70 KB)
avatar
Moderator
3418
GumRai 2016.01.26 05:13 #
 

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 

avatar
125
zirkoner 2016.01.26 18:32 #
 
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.
avatar
10
LukeB 2016.01.28 03:15 #
 
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.
Back to topics list  

To add comments, please log in or register