logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Henning  
#1 Posted : Wednesday, January 7, 2009 5:35:15 PM(UTC)
Henning

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/15/2005(UTC)
Posts: 8
Location: Berlin, Germany

Hi,

I like to know (for use in system test), which HHV is my High of today
.
Of course I could write "If (H=HHV(H, 20),20,If(H=HHV(H,19),19,...) and so on, but this is not satisfying. You are also delimited by the number of lines of a function.

Does somebody know how to solve this, no matter if today H is HHV of 5 or 177?

Henning (Berlin, Germany)
*PP  
#2 Posted : Friday, January 9, 2009 3:22:12 AM(UTC)
*PP

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
*PP  
#3 Posted : Friday, January 9, 2009 3:26:08 AM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

sorry, the above formula will give u the high of prevous day, i guess i ddi not payed atenntion enough to your question.

the high of the day you can find by using

highestsince(1,dayofmonth()<>ref(dayofmonth(),-1),h);
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.