MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Signal Count Within Date Period by Jose Silva

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: sparkie1168 <sparkie68[at]aanet.com.au>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Wednesday, February 22, 2006, 1:08:29 AM
Subject: [EquisMetaStock Group] Number of MA cross overs

Hi All

Does anybody know how to add the number of times 2 moving averages cross over in say a 12 month period??

Regards

Sparkie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Wednesday, February 22, 2006, 10:39:22 AM
Subject: [EquisMetaStock Group] Re: Number of MA cross overs

Try this MS indicator:

Signal Count Within Date Period

{ For personal use only.
http://www.metastocktools.com }

{ Date inputs }
StDay:=Input("start Day",1,31,1);
StMnth:=Input("start Month",1,12,1);
StYear:=Input("start Year",1800,2200,2005);
EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2005);

{ Selected date period }
start:=Year()>StYear
OR (Year()=StYear AND (Month()>StMnth
OR Month()=StMnth AND DayOfMonth()>=StDay));
end:=Year()<EnYear
OR (Year()=EnYear AND (Month()<EnMnth
OR Month()=EnMnth AND DayOfMonth()<=EnDay));
period:=
start AND (end OR (start AND Alert(start=0,2)));

{ Signal - SMA crossover example }
ma1:=Mov(C,5,S);
ma2:=Mov(C,21,S);
signal:=Cross(ma1,ma2);

{ Restrict signals to selected time period }
signalRes:=signal*period;

{ Count signals }
signalCount:=Cum(signalRes);

{ Plot in own window }
signalCount

jose '-)
http://www.metastocktools.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: sparkie1168 <sparkie68[at]aanet.com.au>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Wednesday, February 22, 2006, 10:23:58 PM
Subject: [EquisMetaStock Group] Re: Number of MA cross overs
Files: <none>
--====----====----====----====----====----====----====----====----====----===--

Hi Jose

The indicator works beautiful. Thanks for that.
So the indicator works out both up & down cross overs
I hope you don't mind?

Regards
Sparkie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22[at]yahoo.com>
To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com>
Date: Thursday, February 23, 2006, 9:35:53 PM
Subject: [EquisMetaStock Group] Re: Number of MA cross overs

I don't mind at all, Sparkie. :)
I actually encourage experimentation with MetaStock - that's one reason I try and code in a manner that can be understood by most.

jose '-)
http://www.metastocktools.com

Source / From: TOP
Metastockusers[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.