Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Patt, A common problem when people use the "=" comparison is they forget that very rarely will this ever be true, so their code often fails. With respect to dates, if there is not a bar on the chart with exactly the same date and time information that you have in your filter, the equality condition will never be met. You need to ensure you trap all of the other possibilities too: Code:
Dy:=Input ("Day ",1,31,1);
Mo:=Input ("Month ",1,12,1);
Yr:=Input ("Year ",2005,2010,2007);
Hr:=Input ("Hours 01 - 24",1,24,9);
Mn:=Input ("Minutes 00 -59",00,30,30);
Prd:=Input ("LookBack ",3,25,7);
x:=
(Year() > yr) OR
(Year() = yr AND Month() > mo) OR
(Year() = yr AND Month() = mo AND DayOfMonth() > dy) OR
(Year() = yr AND Month() = mo AND DayOfMonth() = dy and Hour() > hr) OR
(Year() = yr AND Month() = mo AND DayOfMonth() = dy and Hour() = hr AND Minute() >= mn);
MyHigh:= HighestSince(1,barssince(x)=0,H);
Plt:=MyHigh*ATR(Prd);
Plt;
Untested.... You might want to reconsider the barssince() condition too? I don't think the code is doing what you expected it to? You might want to try cum(isdefined(x))=1 instead? Hope this helps. wabbit [:D]
|