- ICustom function
- ICustom ZigZag returns zero value
- ZigZag
iCustom(NULL,0,"ZigZag",12,5,3,3,0);Does the zig-zag indicator have a buffer number 3?
I have been using the following line: double ThisZigZag = iCustom(NULL,0,"ZigZag",12,5,3,3,0); in order to try to work out whether or not the indicator is going up or down but it just returns 0.0 (zero) all the time. I have spent all day trying to get some help and would welcome any suggestions.
I don't even know if this is right, but I just get the buffer values for each bar of zigzag. zz always returns 0 unless there is a change in direction.
In this example, there was a change in zz at bar 3. And the way I read the buffers is that buffer 0 indicates there IS a change in direction - if non-zero
Buffers 1 and 2 indicate the direction; in this case at bar 3 the direction is up, and at bar 10, down...
And, from there you can get the price, time etc base on the bar no.
string txt; string sym=_Symbol; int period=_Period; for(int i=0;i<12;i++){ txt=StringConcatenate(txt,"\nBar ",i," "); for(int j=0;j<=2;j++) txt=StringConcatenate(txt,iCustom(sym,period,"zigzag",12,5,3,j,i)," "); } Comment(txt); /* Bar 0 0 0 0 Bar 1 0 0 0 Bar 2 0 0 0 Bar 3 1.53236 0 1.53236 Bar 4 0 0 0 Bar 5 0 0 0 Bar 6 0 0 0 Bar 7 0 0 0 Bar 8 0 0 0 Bar 9 0 0 0 Bar 10 1.53755 1.53755 0 Bar 11 */
I don't even know if this is right, but I just get the buffer values for each bar of zigzag. zz always returns 0 unless there is a change in direction.
In this example, there was a change in zz at bar 3. And the way I read the buffers is that buffer 0 indicates there IS a change in direction - if non-zero
Buffers 1 and 2 indicate the direction; in this case at bar 3 the direction is up, and at bar 10, down...
And, from there you can get the price, time etc base on the bar no.
I don't even know if this is right, but I just get the buffer values for each bar of zigzag. zz always returns 0 unless there is a change in direction.
In this example, there was a change in zz at bar 3. And the way I read the buffers is that buffer 0 indicates there IS a change in direction - if non-zero
Buffers 1 and 2 indicate the direction; in this case at bar 3 the direction is up, and at bar 10, down...
And, from there you can get the price, time etc base on the bar no.
It's right - you just need to exclude the zero values, as SetIndexBuffer stores value for each bar. Try this:
string txt; double zHigh, zLow; int count = 0; for(int i = 0; i < Bars; i++){ zHigh = iCustom(NULL, 0, "ZigZag", 12, 5, 3, 1, i); zLow = iCustom(NULL, 0, "ZigZag", 12, 5, 3, 2, i); if(zHigh > 0 || zLow > 0){ txt = StringConcatenate(txt, "\n\n\nBar ", i, " "); for(int j = 0; j <= 2; j++)txt = StringConcatenate(txt, iCustom(NULL, 0, "ZigZag", 12, 5, 3, j, i), " "); count++; if(count >= 12)break; } } Comment(txt);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use