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

Notification

Icon
Error

3 Pages<123>
Options
Go to last post Go to first unread
Jose  
#21 Posted : Monday, December 12, 2005 3:02:01 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
I think you'll need some more beer, Sportrider - your code doesn't plot any High/Low signals (only one of each allowed per month) as shown in this sample chart. jose '-)
wabbit  
#22 Posted : Monday, December 12, 2005 3:52:35 AM(UTC)
wabbit

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)
Jose wrote:
Wabbit, I'm hoping no one is crazy enough to buy any stock that trades for only one month each year. :)
Bullet-proof is bullet-proof.
Jose wrote:
BTW, you're expected to do well in this competition, Wabbit. ;)
You get me the time... I'll get you the code! 69 days to go. wabbit :
kanellop  
#23 Posted : Monday, December 12, 2005 8:19:01 AM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

When i put into my Metastock 9.1 Pro for E-Signal in the Indicator Builder to a New Formula Creation the: --->Start---> Days:=Cum(1); DaysLoaded:=LastValue(Days); DaysRemaining:=DaysLoaded-Days; StartOfMonth:=(Month()>Ref(Month(),-1)) OR (Month()=1 AND Ref(Month(),-1)=12); Months:=Cum(StartOfMonth); MonthsLoaded:=LastValue(Months); MonThsRemaining:=MonthsLoaded-Months; EndOfMonth:=(Month()<Ref(Month(),1)) OR (Month()=12 AND Ref(Month(),1)=1); HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0); LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH)); LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0); LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW)); DaysPassed:=BarsSince(StartOfMonth); LastDay:=LastValue(DaysPassed); DaysLeftInMonth:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), Endofmonth,DaysPassed)),LastDay)-DaysPassed; currenthigh:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), EndOfMonth,HighDaysAgo)),LastHigh); currentLow:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), EndOfMonth,LowDaysAgo)),LastLow); HighDay:=If(DaysLeftInMonth=Currenthigh,1,0); LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0); HighDay; LowDay; <---End<--- I received the Message: This constant is being used incorrectly But when put the above Formula in the same Field without the --->Start---> and <---End<--- meaning: Days:=Cum(1); DaysLoaded:=LastValue(Days); DaysRemaining:=DaysLoaded-Days; StartOfMonth:=(Month()>Ref(Month(),-1)) OR (Month()=1 AND Ref(Month(),-1)=12); Months:=Cum(StartOfMonth); MonthsLoaded:=LastValue(Months); MonThsRemaining:=MonthsLoaded-Months; EndOfMonth:=(Month()<Ref(Month(),1)) OR (Month()=12 AND Ref(Month(),1)=1); HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0); LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH)); LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0); LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW)); DaysPassed:=BarsSince(StartOfMonth); LastDay:=LastValue(DaysPassed); DaysLeftInMonth:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), Endofmonth,DaysPassed)),LastDay)-DaysPassed; currenthigh:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), EndOfMonth,HighDaysAgo)),LastHigh); currentLow:=If(MonthsRemaining>0, LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV), EndOfMonth,LowDaysAgo)),LastLow); HighDay:=If(DaysLeftInMonth=Currenthigh,1,0); LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0); HighDay; LowDay; work well. Do you have opinion for that? George K.
Jose  
#24 Posted : Monday, December 12, 2005 12:39:33 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
kanellop wrote:
But when put the above Formula in the same Field without the --->Start---> and <---End<--- work well. Do you have opinion for that?
Yes, George, I do. "--->Start--->" and "<---End<---" are not valid MetaStock code lines. I'm glad that you have worked it out. jose '-)
kanellop  
#25 Posted : Monday, December 12, 2005 1:30:45 PM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Dear Jose, I received your Message. I appreciate your answer. Now, i understand! The Formula is Valid without the --->Start---> and <---End<--- George K.
Jose  
#26 Posted : Monday, December 12, 2005 2:19:58 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
George, Message received and acknowledged. Over and out. jose '-)
sportrider  
#27 Posted : Tuesday, December 13, 2005 12:19:38 AM(UTC)
sportrider

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/12/2005(UTC)
Posts: 141
Location: Brooklyn,NY

Jose, Well I did like you said -I had a few more beers,-but it didnt work it all looked like a different language by then-lol....I will try again today...I see that my plots work outbut with the new highs and lows .... ... I take it that this indicator would only plot previous months high low not the current month because technically the current month high low wont be know until the end of the month..,or is the everchanging current month also required?
Jose  
#28 Posted : Tuesday, December 13, 2005 12:57:07 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Sportrider, if we where looking for the High/Low of the past month, this competition would have ended before it started. Rather than continuously repeating the conditions for the required task, please take a good look at this sample chart, and see if you can code the appropriate signals in MetaStock. jose '-)
guara_riua  
#29 Posted : Wednesday, December 14, 2005 10:57:27 PM(UTC)
guara_riua

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/24/2005(UTC)
Posts: 77
Location: Canada

This competition is just pointing to the fact that MSFL is mainly a collection of function calls and routines, lacking 2 or more basic constructs: Loops and Indexed Arrays. Not to mention reliable recursive references instead of PREV. It's ridiculous - in my opinion - to be forced to use constructs like "+PREV-PREV" to achieve the right result. (I am not very clear yet about how this construct works and when it should be used - some comments from experts will be appreciated) The competition target is just so easy to achieve using a simple conditional loop search after the Highest High was identified for each Month. I was told there is a developers group that is working to bring a new life into the MFSL (suggestions@equis.com) and the new features will include loops, indexed arrays and other constructs that are supposed to be part of any decent formula language. Forgive my lack of enthusiasm, but years passed and Equis haven't implemented yet a basic trading tool feature that is to support Intraday Time Frames for 2,4 and 8 hrs. I hope to hear some good news next year. Guara
Jose  
#30 Posted : Thursday, December 15, 2005 12:35:58 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
No, Guara - this competition is about using your own skills in conjunction with the available tools in MetaStock. If there was an easy function or answer to this riddle, then this competition wouldn't exist in its current form. There is no need for "+PREV-PREV" tricks to obtain the month's High/Low in hindsight - all tools for this purpose are already available as standard within MetaStock. jose '-)
Jose  
#31 Posted : Thursday, December 15, 2005 12:46:30 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
The 2nd of eight lines of code has now been posted. Watch for the 3rd hint this coming Sunday 18th Dec! jose '-)
johnl  
#32 Posted : Thursday, December 15, 2005 2:58:11 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Not much of a hint...... I have learned about the barssince and the valuewhen functions but..... haven't figured out how to control that "lastvalue" function yet.
Jose  
#33 Posted : Friday, December 16, 2005 6:10:54 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Johnl, I have a feeling that you and I are on very different planets. I've really got no idea why you keep mentioning the LastValue function. jose '-)
johnl  
#34 Posted : Friday, December 16, 2005 6:17:16 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

I am sure we are, I think I need the lastvalue function to reference the last high of several higher highs in a given month in a ref() function referencing that high. I can get the highest high on the last of the month (easy) but need something to put the signal "back where it belongs". Sounds like you have come up with something better.
Jose  
#35 Posted : Sunday, December 18, 2005 4:22:40 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Congratulations to Wabbit for his lateral-thinking solution! Wabbit has chosen the excellent PremiumData package (valued at between US$290 & $440) for his prize. Wabbit's solution will be released when we have our final winner. We are now looking for our third & final winner who can code the month's High/Low signals without any PREV functions. The 3rd & 4th of eight lines of code have now been posted here. Watch for the crucial 5th hint this coming Thursday 22nd Dec! jose '-)
StorkBite  
#36 Posted : Sunday, December 18, 2005 4:45:26 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Way to go Wabbit!
wabbit  
#37 Posted : Sunday, December 18, 2005 5:27:25 AM(UTC)
wabbit

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)
Thanks G.... Where's your entry? wabbit :D
StorkBite  
#38 Posted : Sunday, December 18, 2005 7:29:55 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
<looking around nervously> :? uhhh... not enough free time... I'm already in J's remedial class, I don't want to mess up again by turning in some half-baked slop. Still, it's nice to know somone who won! You earned it. Congrats!
sportrider  
#39 Posted : Tuesday, December 20, 2005 3:29:15 AM(UTC)
sportrider

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/12/2005(UTC)
Posts: 141
Location: Brooklyn,NY

Jose, I have a question.If you can't answer it because of the answer will give away the competition then I'll just wait till after or maybe I'll understand it when the next line of code is given on the 22nd. My question is :why do you need to identify even and odd months in this indicator? Thanks in advance.
Jose  
#40 Posted : Tuesday, December 20, 2005 5:07:50 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Sportrider, without giving away too much, the odd/even months flag is part of the only solution that I've found to get around this tricky problem. It separates signals from one month to the next. Perhaps a better name for the "odd/even months" variable would be "alternate months". jose '-)
Users browsing this topic
Guest (Hidden)
Similar Topics
MetaStock programming competition! (General Chat)
by StorkBite 12/8/2005 8:43:29 PM(UTC)
MetaStock programming competition! (Welcome!)
by Jose 12/8/2005 8:38:57 PM(UTC)
3 Pages<123>
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.