Beginner Qustion: Get the last Zigzag high value

 

Hi Guys, I am trying to get the last Zigzag high value as following code:

input int InpDepth=12;
input int InpDeviation=5;
input int InpBackstep=3;
void OnTick()
{  
double highzigzag1,high1;
highzigzag1 = iCustom(Symbol(),PERIOD_CURRENT,"ZigZag",InpDepth,InpDeviation,InpBackstep,1,0);
if (highzigzag1 > 0.001)
{
high1 = highzigzag1;
Print("high_1_inner: ", high1);
}
Print("high_1_outter: ", high1);
}

When I only print the value in the "if" function(the first "Print"), it wroks good as attach1 screenshot. But when I print it both inner and outter "if" function, the outter one keeps changing, shown as

attach2 screenshot.

I just can not understand why I can not get that value out of the "if" function.

Can someone help me if any ideas? Thank you, very much.

By the way, this is my first time to ask question here, and not sure if any inappropriate behaviour. Please let me know.

Files:
attach1.png  25 kb
attach2.png  32 kb
 

Sorry for the double post, cause I found less people in that topic where I first post and the last reply is two weeks ago. I will delete that one.

Thank you for your link!

 
Ran Li #: Sorry for the double post, cause I found less people in that topic where I first post and the last reply is two weeks ago. I will delete that one.
It has already been removed and you should have received a private system message informing you about it.
 
Fernando Carreiro #:
It has already been removed and you should have received a private system message informing you about it.

Yes, I got that message.

Thank you!