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 #

Count Number of Day Between Dates by Roy Larsen
Hello Everyone,

I would like to know that there may be such a program in Metastock I can use to count number of day between two dates. For example,I do reverse count from 4/30/2003 to 4/2/2003 that is 20-day including Holiday. it is not an easy task to count hundreds days manually. I appreciate anyone can help me with this or point me towards a right
direction.

Thank You


l1ntt

An indicator as simple as that below will count the total number of bars in a chart, and therefore allow you to easily calculate the difference between two bars. This will not count missing bars or weekends. This simple concept can be enhanced by adding a bar count to a date filter as demonstrated in the second indicator. If neither of these methods is appropriate the you should investigate the work of Jose Silva at StockCentral.

Hope this helps.

Roy


Count Number of Day Between Dates

{Bar Count}
Cum(1);

{Date Filter Count}
Sd:=Input("Start day" ,1,31,1);
Sm:=Input("Start month",1,12,1);
Sy:=Input("Start year" ,1980,2003,2000);
Ed:=Input("End day" ,1,31,20);
Em:=Input("End month" ,1,12,6);
Ey:=Input("End year" ,1980,2003,2003);
Df:=((DayOfMonth() >= Sd AND Month() = Sm AND
Year()=Sy) OR Year() > Sy OR (Year() = Sy AND
Month() > Sm))
AND
((DayOfMonth() <= Ed AND Month()=Em AND
Year() = Ey) OR Year() < Ey OR (Year() = Ey AND
Month() < Em));
If(Df,Cum(Df),0);

 

Source / From: TOP
equismetastock[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.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!