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

Notification

Icon
Error

Options
Go to last post Go to first unread
jjstein  
#1 Posted : Friday, August 18, 2006 11:14:24 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)

I'm using this as an Expert "Highlight", but it only works AFTER the 3rd Friday, whereas it's SUPPOSED to work the week OF the 3rd Friday.

Code:

_Options Expiration Week
ThirdFriday:=DayOfWeek()=5 AND DayOfMonth()>=15 AND DayOfMonth()<22;
Result:=If(ThirdFriday OR
Ref(ThirdFriday,+1) OR
Ref(ThirdFriday,+2) OR
Ref(ThirdFriday,+3) OR
Ref(ThirdFriday,+4),1,0);
Result;
wabbit  
#2 Posted : Friday, August 18, 2006 11:36:21 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)
JJ,

You are obviously talking about the results not showing correctly in the right hand side of the chart? That's because you haven't updated your data for this week to show today's (Friday's) data, which is the third Friday in the month!

The reason the code fails when yuor last date loaded is Thursday is because Friday doesn't "exist" yet so the code cannot return true for the ThirdFriday variable. This is yet another problem when trying to look into the future.

To find all the days in the week of the third Friday of the month, you are going to have to code conditions for each day in that week.



wabbit [:D]
jjstein  
#3 Posted : Friday, August 18, 2006 1:02:16 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
So the "Ref" function's ability to look forward is limited to a horizon of data which already exists?
Jose  
#4 Posted : Friday, August 18, 2006 10:47:04 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)
Johnathan, for correct signalling of the Nth calendar week within a month, try the Week of Month indicator from MetaStockTools.com. jose '-)
jjstein  
#5 Posted : Saturday, August 19, 2006 2:42:55 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)

Using an Expert, a plot of my previous code as a "Highlight" and your "Week Of Month" for Week 3 as a "Symbol" shows that they do not line up in the past. Also, it shows that this past week only has 4 days -- also the case for Jan & Feb of this year.

Unless I'm using it wrong...

Jose  
#6 Posted : Saturday, August 19, 2006 4:37:18 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)
Johnathan, forget the forward referencing in your previous indicator - it will just confuse you. Use my indicator instead, as it being calendar-based means that it plots correct Nth week signals at all times, irrespective of any missing data. And if this week only has 4 days (and now being the weekend), you are then missing a day's data. jose '-)
jjstein  
#7 Posted : Saturday, August 19, 2006 5:52:40 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)

Plotting your indicator for "WeekOfMonth:=3" only gives four days of the week- Monday is ignored.

I'm looking at your code, but may not be following the logic -- how do you account for June 12, 2006 being a Monday in the 3rd week?

The code has it as the 2nd week: "If(d>7 AND d<=14,2".

Jose  
#8 Posted : Saturday, August 19, 2006 8:14:59 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)
Hmmm... you must be using my older version of the WeekOfMonth indicator. It used the DayOfMonth() function to count weeks, and is not that useful. Try the latest version of the Week of Month indicator from MetaStockTools.com - it uses a calendar-driven engine for correct Mon~Sun Nth week of month. jose '-)
jjstein  
#9 Posted : Saturday, August 19, 2006 8:44:29 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Yup, that'll do! Thanks, Jose.
smg  
#10 Posted : Sunday, August 20, 2006 11:33:29 PM(UTC)
smg

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/13/2005(UTC)
Posts: 90

Johnathan ,

There is an inbuilt Option Expiration function - please see if it helps you.

Regards,

Smg

jjstein  
#11 Posted : Monday, August 21, 2006 9:10:53 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)

I don't usually use the "options" functions -- didn't think to look there...

It looks like "OptionExp()" will work, too.

Thanks.

Users browsing this topic
Guest (Hidden)
Similar Topics
Metastock 8 real time data date problem (MetaStock)
by Mimisss 2/28/2012 4:24:23 AM(UTC)
Symbol Database Update Problem (Data Related Questions)
by Shanghai 10/1/2009 12:30:56 AM(UTC)
Downloader date problems (MetaStock)
by geostat 2/26/2006 7:20:43 AM(UTC)
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.