Hi PT
Yes, my formula does take care of potential errors caused by holidays on certain weeks. It also takes care of missing days or data gaps for any other reason.
Weekly Camarilla levels can easily be calculated from the weekly prices, assuming that you have the formulas for these levels (the way you calculate Camarilla levels might be different from the way I do). Setting the Q variable default to 2 would hold the previous week’s levels until the first intraday bar of the new trading week begins to form. Outputs can easily be forced to plot values relating just to the previous week by wrapping each price definition in LastValue().
The formula for weekly Camarilla levels is shown below with all 8 levels restricted to plotting on 25 bars only. This limitation can be easily changed by adjusting the last definition of "Z". The indicator should plot on intraday charts as well as EOD charts, still returning weekly levels of course.
Daily levels could be based on my "Multi-Frame X OHLC" formula but I can’t show that here as it’s only available to MSTT subscribers or owners of the Multi-Frame Intraday kit. However, something quite simple (but adequate for the task) could be put together using DayOfWeek()<>Ref(DayOfWeek(),-1) as a start-of-new-week trigger for sampling daily prices.
Roy
{Multi-Frame D Camarilla Levels}
{Requires Equis Forum DLL}
{Roy Larsen, 2009, 8/10/09}
{User settings}
N:=Input("Multi-Frame D Camarilla Levels",0,0,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,2);
{Update on last bar, new bar or new frame}
{Timing signals}
{Day counter courtesy metastock@wabbit.com.au}
M:=Month();A:=Int((14-M)/12);D:=DayOfMonth();
Y:=Year();X:=Y+4800-A;B:=M+(12*A)-3;Z:=Cum(1);
M:=If(J=0,D+Int((2+153*B)/5)+(365*X)+Int(X/4)-
Int(X/100)+Int(X/400)-32045,{day counter}
(Y-ValueWhen(1,Z=1,Y))*12+M){month counter};
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 OR I;
F:=G OR (M=0)*ExtFml("Forum.Sum",Ref(I,1),1);
A:=LastValue(Z-1)=Z;B:=LastValue(Z)=Z;
F:=F+B*(Q=0)*(J=0)*(DayOfWeek()=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 OR Z=1,O);
Om:=ValueWhen(1,J,If(J=1,Om,ValueWhen(2-G,1,Om)));
Hm:=HighestSince(1,M OR Z=1,H);
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=LowestSince(1,M OR Z=1,L);
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)));
Z:=LastValue(Z)-25=Z;
{Camarilla levels}
ValueWhen(1,Z,LastValue(K+(Hm-Lm)*1.1/2)); {R4}
ValueWhen(1,Z,LastValue(K+(Hm-Lm)*1.1/4)); {R3}
ValueWhen(1,Z,LastValue(K+(Hm-Lm)*1.1/6)); {R2}
ValueWhen(1,Z,LastValue(K+(Hm-Lm)*1.1/12));{R1}
ValueWhen(1,Z,LastValue(K-(Hm-Lm)*1.1/12));{S1}
ValueWhen(1,Z,LastValue(K-(Hm-Lm)*1.1/6)); {S2}
ValueWhen(1,Z,LastValue(K-(Hm-Lm)*1.1/4)); {S3}
ValueWhen(1,Z,LastValue(K-(Hm-Lm)*1.1/2)); {S4}