Expert code... - page 2

 

Question: Why is the value of 471 returning from the iCustom as zero? Is it indexing one past the limit to end the loop and causing it to become zero?

Pay attention to "int shift" field below.

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

The shift will substitute "i" in your indicator
Therefore, if you put "shift=0" in your expert and call indicator it will set "i=0".
Since you have written into Array[i]=i your call via iCustom will return "0".
If you want to return 471 than you must set "shift=471" in your iCustom call to get value 471 previously written to that location.
 
double Array[] means array of zero size. You need to resize it or declare with size
double Array[1000];

But Slawa,
He is referring to the Array as a indicator Buffer 0.
You do not have to specify indicator Buffer size, do you?

There is too hard to read unformatted text. I see. My mistake
 
You ask for 0 element
===
double TL00 = iCustom(NULL, 0, "custom_test_indicator",A,B,0,0);
Print(" Result: ", TL00);
===
Your 0 element has value 0
===
for(i=0; i <= limit; i++)
{
Array[i] = i;
}
===
 
Thanks for the comments...I will try a few more tests to debug.
Reason: