Rank: Newbie
  Groups: Registered, Registered Users Joined: 2/12/2007(UTC) Posts: 2
  
 
     | 
    
        
            
	      
                Hi wabbit, 
Thank you for you reply. Actually what i want to do is to build my own zigzag to find the recent high and low, just like PeakBars. I don't want to use the build in zigzag so i try to do it myself 
percentage:=3; 
{Determine whether it is a rising trend or falling trend, 1= rising, -1=falling} trend:= If(PREV=1,  If((ref(recenthigh, -1)-C)*100/(ref(recenthigh, -1)+0.0001)<percentage,  PREV,  -1  ),  If((C-ref(recentlow, -1))*100/(ref(recentlow, -1)+0.0001)<percentage,  PREV,  1  ) ); 
{Find the recent low} recentlow:= (Cum(1)=1)*C+ If(trend=-1),  If(Ref(trend, -1)=1,  C,  If(C<PREV,  C,  PREV  )  ),  PREV ); 
{Find the recent high} recenthigh:= (Cum(1)=1)*C+ If(trend=1),  If(Ref(trend, -1)=-1,  C,  If(C>PREV,  C,  PREV  )  ),  PREV ); 
Here trend needs recenthigh and recentlow, and recenthigh and recentlow needs trends. That's what i mean multiple reference. If I am not allowed to write something like this, then what can i do if I want to write something like zigzag? 
Thank you! Thomas  
            
  
         
     |