logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
chheda  
#1 Posted : Wednesday, January 14, 2009 9:57:35 AM(UTC)
chheda

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/31/2004(UTC)
Posts: 14

Thanks: 4 times

Dear Sir

I am using Daily /Weekly Macd formula from http://www.metastocktips.co.nz/ site by respected Roy Larsen . How to plot simple moving average (signal line) of above indicator or any other indicator in lower time frame ?

Please help me for above formula .

Thank you very much for help .

Harish

Note : In above formula by Roy Larsen signal line is exponential moving average.

johnl  
#2 Posted : Thursday, January 15, 2009 10:33:51 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


Did you look at the "Other Formulas" tab after following that link? Those formulas can be
cut and pasted into Metastock.
chheda  
#3 Posted : Friday, January 16, 2009 3:46:55 AM(UTC)
chheda

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/31/2004(UTC)
Posts: 14

Thanks: 4 times

johnl wrote:

Did you look at the "Other Formulas" tab after following that link? Those formulas can be
cut and pasted into Metastock.

Thanks for replay

Formula on site for Macd with EMA as Signal Line

Quote:

{Daily MACD}
{This indicator uses the Equis Forum DLL}
{Roy Larsen, 2004-2007}

{User settings}
N:=Input("Daily MACD, Signal Periods",1,19,9);
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}

{Daily 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:=M-ValueWhen(2,1,M);
B:=I=1 AND Max(Hour(),Minute())=0;
G:=LastValue(Highest(Sum(I>0,5))=5);
I:=I AND B=0 OR ValueWhen(2,1,B); 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));

{Daily CLOSE}
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));

{Calculate and plot Daily MACD}
X:=0.15; Y:=0.075; N:=2/(N+1);
X:=If(Cum(J>0)=1,K,PREV*If(J,1-X,1)+If(J,K*X,0));
{X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);}
Y:=If(Cum(J>0)=1,K,PREV*If(J,1-Y,1)+If(J,K*Y,0));
{Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);}
R:=X-Y;
Z:=If(Cum(J>0)=1,R, PREV*If(J,1-N,1)+If(J,R*N,0));
{Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-N)+R*N);}
R; {MACD}
Z; {Signal}

I am trying to convert EMA Signal Line to SMA Signal Line as follow

Quote:

{Daily MACD}
{This indicator uses the Equis Forum DLL}
{Roy Larsen, 2004-2007}

{User settings}
N:=Input("Daily MACD, Signal Periods",1,19,9);
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}

{Daily 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:=M-ValueWhen(2,1,M);
B:=I=1 AND Max(Hour(),Minute())=0;
G:=LastValue(Highest(Sum(I>0,5))=5);
I:=I AND B=0 OR ValueWhen(2,1,B); 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));

{Daily CLOSE}
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));

{Calculate and plot Daily MACD}
X:=0.15; Y:=0.075; N:=2/(N+1);
X:=If(Cum(J>0)=1,K,PREV*If(J,1-X,1)+If(J,K*X,0));
{X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);}
Y:=If(Cum(J>0)=1,K,PREV*If(J,1-Y,1)+If(J,K*Y,0));
{Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);}
R:=X-Y;
Z:=Cum((J>0)* R);
R; {MACD}
(Z-ValueWhen(N+1,J>0,Z))/N;{Signal}

But I am getting horizontal line value zero for Signal Line . I am not getting what I am doing wrong .

Thanks

Harish

johnl  
#4 Posted : Sunday, January 18, 2009 8:25:43 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


I have tried to modify those formulas also with no luck. The code to modify is way too
embedded for my simple mind to find.
chheda  
#5 Posted : Monday, January 19, 2009 2:36:05 AM(UTC)
chheda

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/31/2004(UTC)
Posts: 14

Thanks: 4 times

johnl wrote:

I have tried to modify those formulas also with no luck. The code to modify is way too
embedded for my simple mind to find.

Thanks for trying to find solution .

Harish

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.