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 Muheeb
Here's the "Multi-Frame D OHLC" indicator set up for weekly data with the first day of the week being Monday and the last day of the week being Sunday. Adjust the offset to change the beginning/end of each week. Each offset increment will delay the transition from one week to the next by one bar. When used without Saturday or Sunday daily data the 5 and 6 offset settings will make no difference to the end-of-week plots. The offset feature does not affect monthly or higher periodicity results in any way.
Roy
{Multi-Frame D OHLC} {Requires Equis Forum DLL} {Roy Larsen, 2008-2009, 30/10/09}
{User settings} N:=Input("Multi-Frame D OHLC (end-of-week offset by N days)",0,6,0); J:=Input("Months per Frame, 0=Weekly",0,12,0); J:=If(J<5 OR Mod(J,3)=0 AND (J<>9),Int(J),-1); Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1); {Update on last bar, new bar or new frame}
{Timing signals} {Day counter by metastocktools.com} D:=DayOfWeek();M:=Month();Y:=Year(); Z:=Cum(1);F:=Rnd(Life(291231)); M:=If(J=0,ValueWhen(1,Z=1,F+D-N-1)-F, (Y-ValueWhen(1,Z=1,Y))*12+M); I:=If(J=0,Int(M/7),Int((M-1)/Max(1,J))); I:=I>ValueWhen(2,1,I); G:=LastValue(J<0 OR Lowest(Sum(I>0,5))=5); I:=ExtFml("Forum.Sum",I,1);M:=G+I; F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)*(Z>1)+G; B:=LastValue(Z);A:=B-1=Z;B:=B=Z; F:=F+B*(Q=0)*(J=0)*(D=5); J:=If(F,1,(Alert(F,2)=0)*M*2*(Z>1)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2,M*2,J));
{Frame prices} Om:=ValueWhen(1,M+(Z=1),O); Hm:=HighestSince(1,M+(Z=1),H); Lm:=LowestSince(1,M+(Z=1),L); Om:=ValueWhen(1,J,If(J=1,Om,ValueWhen(2-G,1,Om))); Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm))); Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm))); K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C))); Om; Hm; Lm; K;
|