Aaaaand...the ZigZag indicator again!!!
-
I recently discovered this outstanding thread about Zigzag indicator from miro:
[https://fxdreema.com/forum/topic/5060/how-to-use-zigzag-advanced]
The only thing I don't find there is how can I capture the proce level of the active leg (what miro calls L0 or H0). I know it changes over time, but I need to know at what price it is right now. I tried to do it this way:

...But to no avail. No price level is shown, only a permanent result of 0.
Any hint?
-
this zigzag value is being checked on the candle 0 ... it has value until it is on that candle, but when zigzag is not on first candle, the value is lost ... you can prevent this loss by using temp value:

this is using two variables .....as the alternative with one variable you can use condition check directly and than write zigzag value to the variable - but this calls zigzag two times and is bit slower as the first variant with two variables

-
Interesting. I'll try it. Thank you very much...again!

-
@miro1360 Sorry, but it doesn't work.
-
it is ... but wait for next value (the first logically can not be read if is not located on candle ID 0 imediatelly after EA is placed on the chart)

-
I'll take a new look on it. Thank you.
-
Once again...miro was right!

Thank you very much.
-
Sorry to bother you again miro, but I have another question. How does this part of the condition block work?

You say in your tutorial that the 'normal' block conditions let you know a past high/low by ID, but not the current leg. My problem is that I don't understand how that past high/low can be found by ID. I tried this to find it:

...and nothing happens. Could you please tell me how can I identify the last high/low?
-
The block Indicator appear is not the right block for working with zigzag.
The block "Indicator is visible" could be theoretically used, but it will not work right.
It will not work because H0 or L0 is always present on the chart (and in this block it is not related to the Candle ID) and because of that the condition "Indicator is visible" will be always true. It can be used only for the current leg, which is related to the candle ID in the block.Few notes, because zigzag is a bit complicated:
-
current leg (0) differs from other legs (1,2, - these are static), because this current leg can be repainted (and often is repainted/updated)
-
zigzag leg ID is not the same as zigzag on the candle ID, but they are related (zigzag leg ID have its own candle ID and this is changed/moved with each new candle .... moreover the change of zigzag leg IDs changes whole relation)
-
for identifying the presence of zigzag leg on the specific candle you must use custom code, whereby you check if zigzag leg is present on the past candles (and save such presence - save candle ID on which the zigzag leg is present)
(I am doing this in my tutorial, where am I looking if the most present zigzag leg is high - H0 or zigzag leg low - L0)
I am not sure, if I remember these things about zigzag right, because it was long ago when I was working with zigzag, and it needed a lot of debugging, because not everything worked as expected

-
-
Once more, thank you for your great help.
