- Katılım
- 23 Eki 2020
- Mesajlar
- 1,828
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: |