[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Plot Daily / Weekly Indicator signal line (Simple Moving Average) in LowerTimeFr



PureBytes Links

Trading Reference Links

Just use the SMA from the site.

http://www.metastocktips.co.nz/daily_sma.txt


Hope this helps,

Preston




--- In equismetastock@xxxxxxxxxxxxxxx, "hkchheda" 
<hkchhedabackup@xxx> wrote:
>
> Hi All ;
> 
> I am using Daily /Weekly Macd formula from 
> http://www.metastocktips.co.nz/ site by respected Roy Larsen . In 
> above formula by Roy Larsen signal line is exponential moving 
> average. I want to replace exponential moving average by simple 
> moving average as signal line in this indicator in lower time 
frame .
> 
> Can someone help me ?
> 
> Formula on site for Macd with EMA as Signal Line :
> 
> {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@xxx}
> 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 :
> 
> {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@xxx}
> 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 .
> 
> Can someone help me to solve the problem in formula .
> 
> Thanks
> 
> Harish Chheda
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/