Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Lily Based on the code supplied earlier in this thread by MS Support (thank you for doing the hard part guys), I've added several modules that account for all holidays observed by the NYSE for the years 2008 through 2020. For obvious reasons I've not tested this indicator beyond the current date. Also note that there are two missing bars for my 2012 data that do not relate to normal holidays, so I've simply treated those days as holidays anyway.
This indicator is not intended for other markets, but if you required an indicator for the TSE, for example, it would an easy enough task to modify the annual holiday modules if past, present and future national holiday data was available. I hope the final forum post displays the same as the Preview I get at this point.
Hope this helps.
Roy
{Days Remaining in Month} {2008-2020}
Q:=Input("Last Day Value, 0 or 1",0,1,0); M:=Month();D:=DayOfWeek(); Y:=Year();A:=DayOfMonth();B:=2000; M30:= M=4 OR M=6 OR M=9 OR M=11; M31:= M=1 OR M=3 OR M=5 OR M=7 OR M=8 OR M=10 OR M=12; M28:=M=2 AND (Mod(Y,4)<>0 OR Mod(Y,100)=0); M29:=M=2 AND Mod(Y,4)=0 AND Mod(Y,100)<>0; Mbars:=If(M30,30,0)+If(M31,31,0)+ If(M28,28,0)+If(M29,29,0);
Days:=Mbars-(A-1); Weeks:=Int((Days+D-1)/7); LastWeek:=Mod(Days+D-1,7); R:=Weeks*5+If(Lastweek>5,5,LastWeek)-D+Q;
Result:=R -(Y=B+8 AND (M=1 AND A<20 OR M=2 AND A<17 OR M=3 AND A<21 OR M=5 AND A<26 OR M=7 AND A<4 OR M=9 AND A<1 OR M=11 AND A<27 OR M=12 AND A<25))
-(Y=B+9 AND (M=1 AND A<19 OR M=2 AND A<16 OR M=4 AND A<10 OR M=5 AND A<25 OR M=7 AND A<3 OR M=9 AND A<7 OR M=11 AND A<26 OR M=12 AND A<25))
-(Y=B+10 AND (M=1 AND A<18 OR M=2 AND A<15 OR M=4 AND A<2 OR M=5 AND A<31 OR M=7 AND A<3 OR M=9 AND A<7 OR M=11 AND A<26 OR M=12 AND A<25))
-(Y=B+11 AND (M=1 AND A<17 OR M=2 AND A<21 OR M=4 AND A<22 OR M=5 AND A<30 OR M=7 AND A<3 OR M=9 AND A<5 OR M=11 AND A<24 OR M=12 AND A<25))
-(Y=B+12 AND (M=1 AND A<16 OR M=2 AND A<20 OR M=4 AND A<6 OR M=5 AND A<28 OR M=7 AND A<4 OR M=9 AND A<3 OR M=11 AND A<22 OR M=12 AND A<25)) -2*(Y=B+12 AND (M=10 AND A<27))
-(Y=B+13 AND (M=1 AND A<21 OR M=2 AND A<18 OR M=3 AND A<29 OR M=5 AND A<27 OR M=7 AND A<4 OR M=9 AND A<2 OR M=11 AND A<28 OR M=12 AND A<25))
-(Y=B+14 AND (M=1 AND A<20 OR M=2 AND A<17 OR M=4 AND A<18 OR M=5 AND A<26 OR M=7 AND A<4 OR M=11 AND A<27 OR M=12 AND A<25))
-(Y=B+15 AND (M=1 AND A<19 OR M=2 AND A<16 OR M=4 AND A<3 OR M=5 AND A<25 OR M=7 AND A<3 OR M=9 AND A<7 OR M=11 AND A<26 OR M=12 AND A<25))
-(Y=B+16 AND (M=1 AND A<18 OR M=2 AND A<15 OR M=3 AND A<25 OR M=5 AND A<30 OR M=7 AND A<4 OR M=9 AND A<5 OR M=11 AND A<24 OR M=12 AND A<26))
-(Y=B+17 AND (M=1 AND A<16 OR M=2 AND A<20 OR M=4 AND A<14 OR M=5 AND A<29 OR M=7 AND A<4 OR M=9 AND A<4 OR M=11 AND A<23 OR M=12 AND A<25))
-(Y=B+18 AND (M=1 AND A<15 OR M=2 AND A<19 OR M=3 AND A<30 OR M=5 AND A<28 OR M=7 AND A<4 OR M=9 AND A<3 OR M=11 AND A<22 OR M=12 AND A<25))
-(Y=B+19 AND (M=1 AND A<21 OR M=2 AND A<18 OR M=4 AND A<19 OR M=5 AND A<27 OR M=7 AND A<4 OR M=9 AND A<2 OR M=11 AND A<28 OR M=12 AND A<25))
-(Y=B+20 AND (M=1 AND A<20 OR M=2 AND A<17 OR M=4 AND A<10 OR M=5 AND A<25 OR M=7 AND A<3 OR M=9 AND A<7 OR M=11 AND A<26 OR M=12 AND A<25));
{Result} ValueWhen(1,Y>=B+8,Result);
|