Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 4/1/2006(UTC) Posts: 135 Location: Romania
|
t2 value in code bellow is the high of the day. This is a old code of mine calculating pivot points for wich is required the high o the day (pivot=(h+l+c)/3. So u can take out the rest and you will have the hhigh of the day. There might be other solutions too but at that point this was what i came up with. Hope it helps you. Remebmer t2 from the code bellow will give u the high of the day.
m:=Input("Days",1,5,1); a:=Cum(If(DayOfWeek()>Ref(DayOfWeek(),-1),1,If(Ref(DayOfWeek(),-1)=5 AND DayOfWeek()=1,1,0))); x:=If(Floor(a/m)=a/m,1,0); y:=If(DayOfWeek()>Ref(DayOfWeek(),-1),1,If(Ref(DayOfWeek(),-1)=5 AND DayOfWeek()=1,1,0)); state:=If(m=1,If(y=1 AND Ref(y,-1)=0,1,0),If(x=1 AND Ref(x,-1)=0,1,0)); t1:=If(LowestSince(1,Ref(state,-1)=1,L)>ValueWhen(1,Ref(state,-1)=1,Ref(L,-1)),ValueWhen(1,Ref(state,-1)=1,Ref(L,-1)),LowestSince(1,Ref(state,-1)=1,L)); t2:=If(HighestSince(1,Ref(state,-1)=1,H)=ValueWhen(1,state=1,H),HighestSince(1,Ref(state,-1)=1,Ref(H,-1)),HighestSince(1,Ref(state,-1)=1,H)); i:=If(state=1,(Ref(C,-1)+t2+t1)/3,0); Pivot:=ValueWhen(1,i<>0,i); R1:=ValueWhen(1,i<>0,(Pivot*2)-t1); S1:=ValueWhen(1,i<>0,(Pivot*2)-t2); R2:=ValueWhen(1,i<>0,Pivot+(t2-t1)); S2:=ValueWhen(1,i<>0,Pivot-(t2-t1)); R05:=ValueWhen(1,i<>0,(Pivot+R1)/2); S05:=ValueWhen(1,i<>0,(Pivot+S1)/2); R15:=ValueWhen(1,i<>0,(R1+R2)/2); S15:=ValueWhen(1,i<>0,(S1+S2)/2); R2; R15; R1; R05; Pivot; S05; S1; S15; S2;
Cheers, *PP www.draculasystems.com
|