help zigzag

 
Well I hope this time it is possible (even my previous posts :-))

I do some statistics with the zigzag indicator.

results are correct but I have 2 things that I can not solve because my knowledge is too small.

data are not updated regularly at every bar I do not know why.

but my biggest problem is that my statistics do not take into account the current swing because sometimes painted and repainted when the results become false wholes you could try to fix the code so that it can take the last swing court and adjust the data based on the last swing and therefore manage when he painted.
I can not thank you I know I spent dozens of hours I can not do too much for me.
thank you for your help.
Files:
zzistats.mq4  24 kb
 
zigzag doesn't update every bar and repaints. You have to figure out when and adjust your code.
 
Set backstep to 1 to avoid repainting and read the up and down buffers.
 
ok thank you all for your answers.
 
good not possible to take into account the last swing but could you correct me my program so that the values ​​or a day? because sometimes I am obliged to restart my indicator for the correct values.
thank you for your help.
Reason: