Hi Rafael
Here's a date filter indicator that has a number of uses including pin-pointing a particular date for an exploration to return prices or other values. As with any indicator using Input() functions the default values must be set to the appropriate date before being used by an exploration. In order to pick up data for the required date the default Input() parameters for at least the "end date" must be set to that date.
{Date Filter}
{Roy Larsen, 2003-2016}
Sd:=Input("Start day" ,1,31,1);
Sm:=Input("Start month",1,12,1);
Sy:=Input("Start year" ,1980,2020,2016);
Ed:=Input("End day" ,1,31,31);
Em:=Input("End month" ,1,12,12);
Ey:=Input("End year" ,1980,2020,2016);
Start:=(DayOfMonth()>=Sd AND
Month()=Sm AND Year()=Sy) OR Year()>Sy OR
(Year()=Sy AND Month()>Sm);
End:=(DayOfMonth()<=Ed AND
Month()=Em AND Year()=Ey) OR Year()(Year()=Ey AND Month()<em);
Start AND (End OR (Start AND Alert(Start=0,2)));
Assuming that both Start Date and End Date default parameters are set appropriately the code for your exploration could be as simple as
{ColA:}
Date:=Fml("Date Filter");
ValueWhen(1,Date,CLOSE);
If the Date Filter indicator is set to a non-trading day then it will return a TRUE for the next valid trading day. Even if the End Date occurs prior to the Start Date the result will point to the first trading day on or after the Start Date. I hope this is of some use.
Roy
Edited by user Monday, August 1, 2016 2:36:41 AM(UTC)
| Reason: Not specified