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

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



PureBytes Links

Trading Reference Links

Thanks Roy Sir ,



Thank you very much for reply and solving the formula problem .

No need to apologies , actually It is great by the way you solve the 
Metastock formula problem for community and I really want to 
congratulate for it .

 

Thanks and Regards
Harish Chheda


--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxx> 
wrote:
>
> Hi Harish
> 
> 
> Apologies if this message shows up twice. My original reply seems 
to have disappeared.
> 
> I don't have all Daily/Weekly/Multi-Frame formulas or intraday data 
with me right now but I think you'll find that the problem lies with 
the revised definition of "N" immediately after the {Calculate and 
plot Daily MACD} header. comment out or delete the "N:=2/(N+1)" 
definition. This definition converts N periods to a ratio for the 
signal EMA and is not needed for the SMA calculation. The original N 
number IS required, and commenting out the redefinition allows the N 
variable to remain unchanged. I've tried my suggestion on EOD data 
and it appears to do as you require. I can't check it on intraday 
data right now.
> 
> I'm including Weekly and Multi-Frame MACD formulas with an SMA 
signal line. These formulas require the use of the Forum DLL, and the 
variable-length Sum function from this DLL is used to generate a more 
accurate SMA.
> 
> 
> Regards
> 
> Roy
> 
> 
>  {Multi-Frame D MACD E}
>  {This indicator uses Equis Forum DLL}
>  {Roy Larsen, 2008}
> 
>  {User settings}
> N:=Input("Multi-Frame D MACD, Signal Periods",1,19,9);
> F:=Input("Timeframe, 0=W  1=M  2=Q  3=6M  4=Y",0,4,0);
> F:=If(F=1,1,If(F=2,3,If(F=3,6,If(F=4,12,0))));
> 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}
> 
>  {Timing signals}
> {Day counter courtesy metastock@xxx}
> M:=Month();A:=Int((14-M)/12);D:=DayOfMonth();
> Y:=Year();X:=Y+4800-A;B:=M+(12*A)-3;Z:=Cum(1);
> M:=If(F=0,D+Int((2+153*B)/5)+(365*X)+Int(X/4)-
> Int(X/100)+Int(X/400)-32045,{day counter}
> (Y-ValueWhen(1,Z=1,Y))*12+M){month counter};
> I:=If(F=0,Int(M/7),Int((M-1)/Max(1,F)));
> I:=I<>ValueWhen(2,1,I);
> G:=LastValue(Lowest(Sum(I>0,5))=5);
> I:=ExtFml("Forum.Sum",I,1);M:=G OR I;
> F:=G OR (M=0)*ExtFml("Forum.Sum",Ref(I,1),1);
> A:=LastValue(Z-1)=Z;B:=LastValue(Z)=Z;
> 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 CLOSE}
> K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
> 
>  {Calculate/plot MACD and signal}
> X:=0.15; Y:=0.075; J:=J>0;
> X:=If(Cum(J)=1,K,PREV*If(J,1-X,1)+J*K*X);
> Y:=If(Cum(J)=1,K,PREV*If(J,1-Y,1)+J*K*Y);
> R:=X-Y; A:=Cum(J);
> M:=ExtFml("Forum.Sum",J*R,Z-ValueWhen(N+1,J,Z));
> Z:=ValueWhen(1,A>N,ValueWhen(1,J,M)/N);
> R; {Weekly MACD}
> Z; {SMA signal line}
> 
> 
> 
>  {Weekly MACD S} 
>  {This indicator uses the Equis Forum DLL}
>  {Roy Larsen, 2004-2007}
> 
>  {User settings}
> N:=Input("Weekly MACD Signal Periods",1,19,9);
> Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,0);
>  {0, update on last bar of current frame}
>  {1, update on each new bar}
>  {2, update on first bar of new frame}
> 
> {Weekly 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:=Int(M/7);
> I:=I-ValueWhen(2,1,I);
> G:=LastValue(Lowest(Sum(I>0,5))=5);
> 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));
> 
>  {Weekly CLOSE}
> K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
> 
> {Calculate and plot weekly MACD and signal line}
> X:=0.15; Y:=0.075; J:=J>0; A:=Cum(J);
> X:=If(Cum(J)=1,K,PREV*If(J,1-X,1)+J*K*X);
> Y:=If(Cum(J)=1,K,PREV*If(J,1-Y,1)+J*K*Y);
> R:=X-Y; Z:=Cum(1);
> M:=ExtFml("Forum.Sum",J*R,Z-ValueWhen(N+1,J,Z));
> Z:=ValueWhen(1,A>N,ValueWhen(1,J,M)/N);
> R; {Weekly MACD}
> Z; {SMA signal line}
>



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

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/