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

Notification

Icon
Error

Options
Go to last post Go to first unread
mkz  
#1 Posted : Monday, August 8, 2005 1:43:13 AM(UTC)
mkz

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2005(UTC)
Posts: 12

Anyone has an idea how to plot the 3rd friday of each month (or 3rd friday of the 3rd month)?
Jose  
#2 Posted : Monday, August 8, 2005 8:00:10 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)
Try this MS indicator code: [code:1:8c92468042] ========================= Calendar Weekday of Month ========================= ---8<--------------------------- { Calendar-absolute, Weekday-of-Month signals } { Plot on separate window below chart } { ©Copyright 2004 Jose Silva } { http://www.metastocktools.com } dayChosen:=Input("day: [1]Mon, [2]Tue, [3]Wed, [4]Thu, [5]Fri",1,7,5); weekChosen:=Input("[1]st [2]nd [3]rd [4]th [5]th week in month",1,5,3); plot:=Input("plot: [1]Weekday signals, [2]Weekday count",1,2,1); day:=DayOfWeek()=dayChosen; d:=DayOfMonth(); signalCount:= If(day AND d<=7,1, If(day AND d>7 AND d<=14,2, If(day AND d>14 AND d<=21,3, If(day AND d>21 AND d<=28,4, If(day AND d>28,5,0))))); signal:=weekChosen=signalCount; If(plot=1,signal,signalCount) ---8<--------------------------- [/code:1:8c92468042] Additionally, if you whish to plot 3rd Friday signals for only the third month of each year, change the last line of code to: [code:1:8c92468042]If(plot=1,signal,signalCount) AND DayOfMonth()=3 [/code:1:8c92468042] jose '-) http://www.metastocktools.com .
mkz  
#3 Posted : Monday, August 8, 2005 9:36:05 AM(UTC)
mkz

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2005(UTC)
Posts: 12

Thnx Jose, UR the man \\:D/ Actually I've been trying to plot the 3rd friday of Options expiration cycles JAJO - January, April, July, and October MJSD - March, June, September, and December FMAN - February, May, August, and November So the formula I am trying to find is to plot 1- 3rd friday of Jan, Apr, Jul, Oct 2- 3rd friday of Mar, June, Sept, Dec 3- 3rd friday of Feb, May, Aug, Nov Your help is much appreciated
mkz  
#4 Posted : Monday, August 8, 2005 4:21:26 PM(UTC)
mkz

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2005(UTC)
Posts: 12

So here it is : =============================== expCyc:=Input("Options Cycle: (1-JAJO 2-MJSD, 3-FMAN, 4-ALL",1,4,4); expDay:=Input("ExpDay: (1-Mon, 2-Tue, 3-Wed, 4-Thu, 5-Fri)",1,7,5); expWeek:=Input("ExpWeek:(1-st, 2-nd, 3-rd, 4-th, 5-th)",1,5,3); plot:=Input("Plot ExpDay (1-Signal, 2-Count)",1,2,1); pplot:=Input("Plot PreExpDay (1-Signal, 2-Count)",1,2,1); day:=DayOfWeek()=expDay; pday:=Ref(day,-1); d:=DayOfMonth(); exp1:=If(Month()=1,1,If(Month()=4,1,If(Month()=7,1,If(Month()=10,1,0)))); exp2:=If(Month()=2,1,If(Month()=5,1,If(Month()=8,1,If(Month()=11,1,0)))); exp3:=If(Month()=3,1,If(Month()=6,1,If(Month()=9,1,If(Month()=12,1,0)))); cycle:=If(expCyc=1,exp1,If(expCyc=2,exp2,If(expCyc=3,exp3,1))); xSignalCount:= If(day AND d<=7 AND cycle,2, If(day AND d>7 AND d<=14 AND cycle,4, If(day AND d>14 AND d<=21 AND cycle,8, If(day AND d>21 AND d<=28 AND cycle,2, If(day AND d>28 AND cycle,2,0))))); signal:=expWeek=xSignalCount; signal2:=expWeek=Ref(xSignalCount,+1); If(plot=1,signal,xSignalCount); If(pplot=1,signal2,Ref(xSignalCount,+1)); ================================= Strangely the "signalCount" is ploted but the "signal" doesn't. What do I do wrong?
henry1224  
#5 Posted : Monday, August 8, 2005 11:23:21 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
optionexp()
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.