Rank: Newbie
  Groups: Registered, Registered Users Joined: 2/28/2007(UTC) Posts: 1
  
 
     | 
    
        
            
	      
                Dear Damien:
 
As per your query following codings would appropriate.
 
pr:=Input("Reversal amount", 0.001,100000,1);
pk:=PeakBars(1,H ,pr)=0; 
tr:=TroughBars(1,L,pr)=0; 
oHi:=Zig(H ,pr,%); 
oLo:=Zig(L,pr,%); 
avg:=(oHi+oLo)/2;
x:=If(H>Ref(H,-1) AND L<ref(L,-1) ,HIGH, 
If(H<=Ref(H,-1) AND L>Ref(L,-1),LOW,
If(H<=Ref(H,-1) AND L<ref(L,-1) ,olo,
If((Ref(LOW,-1)>(H>Ref(H,-1) AND L>Ref(L,-1))) ,HIGH ,
If((Ref(HIGH,-1)>(H>Ref(H,-1) AND L>Ref(L,-1))),LOW, If(avg>Ref(avg ,-1),L,H)))) ));
X1:=Zig(x,pr,%); 
X1;
 
But not equals to the indicator ploted on HSI graph that you had sent me via e-mail. You have to rewrite the rules if you want an accurate indicator equals to the indicator ploted on HSI graph . 
 
1- Swing lines connect either Highs or Lows of individual bars - never Open or Close.
2 -If the next bar has a higher high and a higher low (or the same low) when compared to the previous bar, then the swing line goes up connecting the high of the next bar.
3- If the next bar has a lower high (or same high) and a lower low when compared to the previous bar, then the swing line goes down connecting the low of the next bar.
4- If the next bar is an inside bar (lower high and higher low than the previous bar), ignore it and don’t plot a line on it at all – wait for the next bar.
5- If the next br is an outside bar (higher high and lower low), plot a swing line on the high of an outside bar if the following bar (one after the outside bar) has a lower low than the outside bar, OR plot a swing line on the low of an outside bar if the following bar (one after the outside bar) has a higher high than the outside bar.
 
However i tried to make it equal with the ploted indicator on HSI graph but some thing is missing or over the rules due these reasons i cant able to shape final. 
 
pr:=Input("Reversal amount", 0.001,100000,.96); 
pk:=PeakBars(1,H ,pr)=0; 
tr:=TroughBars(1,L,pr)=0; 
oHi:=Zig(H ,pr,%); 
oLo:=Zig(L,pr,%); 
avg:=(oHi+oLo)/2; 
x:=If(pk,ohi,If(tr,olo, 
If(Inside(),PREVIOUS, 
If(Outside(),LOW ,If(Outside()>Ref(H,-1),LOW,If(L>Ref(Outside(),-1),HIGH, avg)))))); 
X1:=Zig(x,pr,%); 
X1; 
 
Regards 
Asad Tirmazie 
Head of Equity 
Azee Securities (Pvt) Limited
 drfund21@yahoo.com
0092321-8247969  
            
  
         
     |