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 Tomtep
There are several reasons why your use of the Weekly ADX indicator does not return the results you expect. Most importanly, are you loading enough data for the Weekly ADX indicator to generate correct values? For a 10-Period ADX etc I'd suggest 400-500 EOD bars might be necessary to get accurate results.
Two other factors to consider are that the standard ADX(), MDI() and PDI() functions provide rounded results, my Weekly ADX does not round results for any or those values. Having said thatYou can round the DIP (PDI) and DIM (MDI) within the exploration - see below.
Not only does the standard MetaStock ADX() function round results but the results become less accurate as the Periods value increases. Try plotting both formulas shown in my first response in this thread with a Periods value of 50 on a weekly chart and you'll see the problem of inaccuracy very clearly.
The rounding that the MS ADX() function uses is not as easy to decipher as it is for MDI() and PDI() so I've made no effort to allign weekly or Multi-Frame results with the standard ADX function. As I've already pointed out the discrete code version of ADX is more accurate than ADX() anyway so why try to emulate a result that is already suspect?
Using the "Multi-Frame D ADX Forum" indicator, here's how to create the exploration. You'll need to set the Periods Parameter for the indicator as needed. Ideally your exploration should be run over the weekend - the weekly value will only update when Friday (end-of-week) data is available.
{colA}
DIP:=FmlVar("Multi-Frame D ADX Forum","DIP");
DIM:=FmlVar("Multi-Frame D ADX Forum","DIM");
WDX:=Fml("Multi-Frame D ADX Forum");
Rnd(DIP)>Rnd(DIM) AND WDX>25;
{filter}
colA;
Remember, there will be differences between "Multi-Frame D ADX Forum" and ADX(). Check out the differences by plotting both on several years of weekly data.
I'm assuming that you also include code for daily conditions in your exploration. If not then it would be simpler to use standard MS functions with the exploration set to weekly.
{Multi-Frame D ADX Forum}
{Requires Equis Forum DLL}
{Roy Larsen, 2008-2010, 11/11/10}
{User settings}
N:=Input("Multi-Frame D ADX Forum, Periods",1,99,10);
J:=Input("Months per Frame, 0=Weekly",0,12,0);
J:=If(5>J OR Mod(J,3)=0 AND (J>9 OR 9>J),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,0);
{Update on last bar, new bar or new frame}
{Timing} {Day count 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(0>J 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}
B:=HighestSince(1,M+(Z=1),H);
Y:=LowestSince(1,M+(Z=1),L);
B:=ValueWhen(1,J,If(J=1,B,ValueWhen(2-G,1,B))); {H}
Y:=ValueWhen(1,J,If(J=1,Y,ValueWhen(2-G,1,Y))); {L}
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C))); {C}
Bi:=ValueWhen(2,J,B); Yi:=ValueWhen(2,J,Y);
Ki:=ValueWhen(2,J,K); J:=J>0; I:=Cum(J);
{Building ADX}
{ATR} A:=Max(Max(Abs(Ki-Y),Abs(Ki-B)),B-Y);
M:=Cum(J*A)/Min(I,N); K:=If(N>I,M,A);
R:=If(J,If(N>I,1,2*N-1),Pwr(10,10));
A:=ExtFml("Forum.Mov",K,R,E);
{DIPlus} D:=If(B>Bi AND Y>=Yi,B-Bi,If(B>Bi
AND Yi>Y AND (B-Bi)>(Yi-Y),B-Bi,0));
M:=Cum(J*D)/Min(I,N); K:=If(N>I,M,D);
DIP:=100*ExtFml("Forum.Mov",K,R,E)/(A+(A=0));
{DIMinus} B:=If(Yi>Y AND Bi>=B,Yi-Y,If(B>Bi
AND Yi>Y AND (Yi-Y)>(B-Bi),Yi-Y,0));
M:=Cum(J*B)/Min(I,N); K:=If(N>I,M,B);
DIM:=100*ExtFml("Forum.Mov",K,R,E)/(A+(A=0));
{ADX} X:=Abs(DIP-DIM)/(DIP+DIM+(DIP+DIM=0));
M:=Cum(J*X)/Min(I,N); K:=If(N>I,M,X);
X:=100*ExtFml("MSTT.EMA",K,R);
ValueWhen(1,I>=2*N,X);
Roy
PS: This indicator has been modified in order to post correctly. If it causes problems I can email you the original.
|