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

Notification

Icon
Error

Options
Go to last post Go to first unread
wecoyote13  
#1 Posted : Thursday, June 9, 2005 2:00:26 AM(UTC)
wecoyote13

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/29/2005(UTC)
Posts: 27
Location: Bay Area

I am reasonably new to Metastock...am wondering is there a function like barssince that has the Nth occurrence option? Like Barssince(nth, expression)... I was kinda shocked that it didn't. I know of highestsincebars and such, but those functions just complicate what I am trying to do. Thanks!
Patrick  
#2 Posted : Thursday, June 9, 2005 2:40:53 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
What about : ValueWhen(nth, Expression,Barssince(something)) Patrick :mrgreen:
wecoyote13  
#3 Posted : Thursday, June 9, 2005 3:30:30 AM(UTC)
wecoyote13

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/29/2005(UTC)
Posts: 27
Location: Bay Area

Wow..first of all thanks for the awesome direction...I still think this is convoluted...more than it needs to be..but here is what I did...using the last day of 2003 as an anchor in time... myosc:= Fml( "My Oscillator"); now:=BarsSince( Year()=2003 ); firsthump:=ValueWhen(1,threeten =Ref(HHV(myosc,6),3),BarsSince( Year()=2003 )); 2ndhump:=ValueWhen(2,threeten =Ref(HHV(myosc,6),3),BarsSince( Year()=2003 )); barssincefirst:=now-firsthump; barssincesecond:=now-2ndhump; And so now I know the bars since the last two humps of this oscillator occurred....that is what I was looking for. Close?
Patrick  
#4 Posted : Thursday, June 9, 2005 3:46:06 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Not sure what you are trying to accomplish #-o But I will offer these changes :D myosc:= Fml( "My Oscillator"); now:=Cum(1); firsthump:=ValueWhen(1,threeten =Ref(HHV(myosc,6),3),now); 2ndhump:=ValueWhen(2,threeten =Ref(HHV(myosc,6),3),now); barssincefirst:=now-firsthump; barssincesecond:=now-2ndhump; ... What is threeten supposed to do ? Ref(HHV(myosc,6),3) - this is a refrence in the future ... are you sure you do not want -3 instead of 3? Patrick :mrgreen:
wecoyote13  
#5 Posted : Thursday, June 9, 2005 3:52:44 AM(UTC)
wecoyote13

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/29/2005(UTC)
Posts: 27
Location: Bay Area

Aaaa...cum(1)...very cool... oh I was half finished changing something when I pasted...sorry...threeten is an oscillator so instead of that "myosc" definition it is actually "threeten" so I am defining peaks in that oscillator as a point that is higher than the surrounding two on either side...threeten =Ref(HHV(threeten,6),3) the idea eventually is to define when the nth peak in the oscillator occurred and what the price was at that time...so I can get the geometry of the price action into some other formulas
Patrick  
#6 Posted : Thursday, June 9, 2005 3:56:07 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Gotcha ... :D I think that you should be able to work it from here. My only concern is that reference( ... ,3 ) You should fix that. Let me know if you need more help oz_pdt_010 Patrick
wecoyote13  
#7 Posted : Thursday, June 9, 2005 4:46:13 AM(UTC)
wecoyote13

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/29/2005(UTC)
Posts: 27
Location: Bay Area

fix that?...like there is a mo better way?
Patrick  
#8 Posted : Thursday, June 9, 2005 4:49:17 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
??? Sorry I did not understand ? Your reference is invalid and will give you false results. You should try removing it and using this instead : threeten =HHV(myosc,6) Patrick :mrgreen:
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.