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;
|
|
|
|
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]
|
|
|
|
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?
|
|
|
|
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)
|
|
|
|
|
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...
|
|
|
|
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 '-)
|
|
|
|
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".
|
|
|
|
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 '-)
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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)
|
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.