Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,540
Thanks: 48 times Was thanked: 123 time(s) in 119 post(s)

Here's another attempt at formatting, thanks Roy for assisting! Code: {MultiFrame D+ ATR}
{Average True Range}
{MSTT DLL by wabbit.com.au}
{Also uses Equis Forum DLL}
{Roy Larsen, 20112014, 3/1/14} {User settings}
N:=Input("MultiFrame D+ ATR, Periods",1,99,10);
J:=Input("Months/Frame, 0=Weekly 5=Biweekly 10=Daily",0,12,0);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,0);
G:=Input("EndofFrame Offset in Days, 013",0,13,0); {D+ Timing}
{Day counter by metastock@wabbit.com.au}
J:=If(J<6 OR J=10 OR Mod(J,3)=0 AND (J<>9),Int(J),1);
M:=Month(); A:=Int((14M)/12); D:=DayOfMonth();
Y:=Year(); X:=Y+4800A; B:=M+(12*A)3;
Z:=Cum(1); M:=If(Mod(J,5)=0,D+Int((2+153*B)/5)+
(365*X)+Int(X/4)Int(X/100)+Int(X/400)32045G,
(YValueWhen(1,Z=1,Y))*12+M);
I:=If(J=0,Int(M/7),If(J=5,Int(M/14),If(J=10,M,
Int((M1)/Max(1,J))))); I:=I>ValueWhen(2,1,I);
G:=LastValue(J<0 OR Lowest(Sum(I>0,5))=5);
I:=ExtFml("Forum.Sum",If(Z=1,1,I),1);M:=G+I;
F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)*(Z>1)+G;
B:=LastValue(Z);A:=B1=Z;B:=B=Z;F:=F+B*(Q=0)
*(DayOfWeek()=5)*(J=0)*(Highest(Hour())=0);
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(2G,1,B)));
Y:=ValueWhen(1,J,If(J=1,Y,ValueWhen(2G,1,Y)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2G,1,C)));
Ki:=ValueWhen(2,J,K); J:=J>0; I:=Cum(J); {ATR}
K:=ExtFml("Forum.SUM",Max(Abs(KiY),Abs(KiB)),1);
K:=Max(K,BY);
M:=Cum(J*K)/Min(I,N); K:=If(I<N,M,K);
R:=If(J,If(I<N,1,2*N1),1);
A:=ExtFml("MSTT.EMA",K,R);
ValueWhen(1,N<=I,A);
