iCustom delivers wrong values

 

Hello !

We programmed a custom indicator, which is doing several calculations.

The Buffers 1 and 2 deliver correct values with the iCustom-function, Buffers 4 and 5 return values with iCustom, different from what the indicator shows in the chart window !

We tried several things, like using variables or an array to store them in an intermediate step, to find a workaround for the problem - but nothing solved it.

I attached an EA (Test-EA-Ind-Kalk.mq4) which shows the values read from the Indicator, and the indicator itself (TEST-Ind-Kalkulationen.mq4), together in the ZIP-file.

Thanks for your help, Klaus

Files:
 

it's working just fine (what bar u checked?)

 
qjol:

it's working just fine (what bar u checked?)


Thank you for the quick response, I have a screen shot from my test here, hope this helps:

 

i'm sorry c for yourself

double i0 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,0,1);
double i1 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,1,1);
// double i2 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,2,1);
double i3 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,3,1);
double i4 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,4,1);
// double i5 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,5,1);
double i6 = iCustom(NULL,0,IndName,IndPeriod,IndMode,IndGlatt,6,1);

 

???

"c for yourself" ?

What do you want to you tell me with the red marked numbers ?
They are only the shift of the bar, so all of them should give me the value of the last complete bar.
What is wrong with this ?
The shift works correct for the Buffers 0 and 1 and 6, but not for 3 and 4.

 
knatterton:

[...]

They are only the shift of the bar, so all of them should give me the value of the last comlete bar.

nop, 1 bar shift = 1 before the last (& It doesn't matter if it's completed or not)


(& in the picture u attached u r standing with the crosshair somewhere in the middle of the chart)
 

OK, however.

If you look at my picture, I print the values if the shift 1 at 11:19, means I read the bar 11:18 where the crosshair is placed.
And WHY are buffers 0 and 1 giving the correct value, but not buffers 3 and 4 ???

Also if I shift the crosshair further to the left (times 11:17, 11:16, and so on), I always read the correct value in buffer 0 and 1 and different values in 3 and 4 !

 

I have one more informations, in case it can help you:

When I let the indicator work through the whole available data of an Symbol, the first bars display the correct result in the chart window and on "print" from the EA. After a few bars the values in buffers 3 and 4 begin to change in the "print" results.

If I can assist in any way, please let me know.

 
do it right
i = Bars - counted_bars - 1;            // Index of the first uncounted   
if(counted_bars>0) i++;
 

I took the programming style from the instructions here on this website: https://book.mql4.com/samples/icustom

And it works properly for the first two buffers - why not for the other two ???

 
knatterton:

I took the programming style from the instructions here on this website: https://book.mql4.com/samples/icustom

And it works properly for the first two buffers - why not for the other two ???


Did you found what the problem is? I have same problem, my indicator for completed bars is different from the print function in the EA. Say Bar2 in Data Window show a value and Print for the same Bar shows a different one. I been trying to find an answer but no luck so far.