Hi
Joa...
Although somewhat off topic, a feature recently added to my D series
(using EOD data) of Multi-Frame formulas is an end-of-week offset capability.
These indicators don?t change the daily data format in any way but they do allow
the user to select a different end-of-week point when plotting a weekly
indicator value on conventional daily data. The default value of 0 (zero offset)
sets day 7, Sunday, as the last day of the week. If, for example, the offset is
changed to 2, the effective end-of-week shifts from Sunday to Tuesday
(DayOfWeek()=2) and then weekly Multi-Frame indicator values are based on
Tuesday prices.
The
offset feature is of no use in most western markets but it is relevant to
markets where weekends fall on days other than Saturday and Sunday. Monthly or
higher frame settings are unaffected by the end-of-week offset as it?s only
applicable to a weekly periodicity setting.
With
around 70 formulas in each of the three MF series the complete Intraday
Multi-Frame package is a genuine must-have for anyone using systems based on
multiple timeframes. Most formulas simulate existing MS functions (for a higher
periodicity) but there is also a growing list of generic formulas in the mix,
Kaufman?s AMA being but one example. A little more information about Multi-Frame
formulas can be found at http://www.metastocktips.co.nz/other_formulas.html.
Below
there?s a D series Multi-Frame Simple Moving Average (for closing prices only)
that includes the end-of-week offset feature. Make sure the current version of the
Forum DLL is installed before copying as a new indicator into the Indicator
Builder. Write to me at rlarsen@xxxxxxxxxx if you?d like more
information.
Roy
{Multi-Frame D
SMA-O}
{Simple Moving
Average}
{Requires Equis Forum
DLL}
{Roy Larsen, 2008-2009,
2/11/09}
{User
settings}
N:=Input("Multi-Frame D SMA-O,
Periods",1,99,10);
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);
G:=Input("End-of-week Offset in
Days",0,6,0);
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-G-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}
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
{Simple
MA}
J:=J>0; A:=Cum(J);
Z:=Z-ValueWhen(N+1,J,Z);
Z:=ExtFml("Forum.Sum",J*K,Z);
ValueWhen(1,J,Z)/Min(N,A);