Hi Senthil
Static and Dynamic settings both plot historical weekly values as soon as Friday data is available. Dynamic differs on the week currently being formed in that it updates on each day of the week, thus returning a dynamic (changing) value until Friday data completes the current week. For example, the weekly close would be updated on the last bar as each day’s data is added. The Dynamic setting is most appropriate when weekly indicator is used visually on EOD charts.
The Static setting is more appropriate for system tests, remembering that that each weekly close becomes available only with the Friday close. In many cases it would be desirable to use the Static setting with a 1-bar delay. The Delayed mode provides this by holding off the weekly update until Monday data is available, i.e. the presence of Monday data is used to signal that the week ended on the previous bar. The Delayed setting is ideal for system testing and prevents the possible use of future data that could otherwise occur with carelessly written formulas.
Either the Static or Dynamic settings can be used at the weekend (after Friday data is added) for explorations requiring weekly data. I suggest you only use the Static setting for explorations during the week.
I suggest you use Mov(Typ(),5,S) on your EOD charts as the 5-period SMA of the pivot point (assuming pivot point is (H+L+C)/3). You could then monitor for this crossing above the higher of the weekly/monthly pivot point SMAs with something like this...
{Pivot Point Cross}
Pds:=Input("EOD Pivot Point Smoothing",1,10,5);
Wsma:=Fml("Weekly Pivot Point SMA");
Msma:=Fml("Monthly Pivot Point SMA");
Cross(Mov(Typ(),Pds,S),Max(Wsma,Msma));
To prevent errors when creating this indicator make sure that the weekly and monthly pivot point SMAs are created first.
{Weekly Pivot Point SMA}
{This indicator uses the Equis Forum DLL}
{Roy Larsen, 2004-2008}
{User settings}
N:=Input("Weekly Pivot Point SMA, Periods",1,99,3);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);
{0, update at last bar of current frame}
{1, update on each new bar}
{2, update on first bar of new frame}
{Weekly frame timing}
{* Day counter from metastock@wabbit.com.au}
M:=Month();A:=Int((14-M)/12);D:=DayOfMonth();
Y:=Year()+4800-A;B:=M+(12*A)-3;
M:=D+Int((2+153*B)/5)+(365*Y)+Int(Y/4)-Int(Y/100)+Int(Y/400)-32045;
{*}I:=Int(M/7);
I:=I-ValueWhen(2,1,I);
G:=LastValue(Lowest(Sum(I>0,5))=5);M:=G+I;
F:=G+(M=0)*ExtFml("Forum.Sum",Ref(I,1),1);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=Alert(A,2)*(A=0);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
{Calculate weekly HLC prices}
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
{Calculate and plot SMA of weekly pivot points}
PP:=(K+Hw+Lw)/3;
J:=J>0; X:=Cum(J*PP);
(X-ValueWhen(N+1,J,X))/N;
{Monthly Pivot Point SMA}
{This indicator uses the Equis Forum DLL}
{Roy Larsen, 2004-2008}
{User settings}
N:=Input("Monthly Pivot Point SMA, Periods",1,99,2);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);
{0, update at last bar of current frame}
{1, update on each new bar}
{2, update on first bar of new frame}
{Monthly frame timing}
D:=DayOfMonth();M:=Month();Y:=Year();
A:=ValueWhen(1,Cum(1)=1,Y);
M:=(Y-A)*12+M;I:=M-ValueWhen(2,1,M);
G:=LastValue(Lowest(Sum(I>0,5))=5); M:=G+I;
F:=G+(M=0)*ExtFml("Forum.Sum",Ref(I,1),1);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=Alert(A,2)*(A=0);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
{Calculate monthly HLC prices}
Hm:=HighestSince(1,M,H);
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=LowestSince(1,M,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)));
Hm:=ValueWhen(1,Hm>0,Hm);
Lm:=ValueWhen(1,Lm>0,Lm);
{Calculate and plot monthly pivot point SMA}
PP:=(K+Hm+Lm)/3;
J:=J>0; X:=Cum(J*PP);
(X-ValueWhen(N+1,J,X))/N;
Roy
MetaStock Tips & Tools