Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
A small bug? C'mon... that's a feature! ;)
[code:1:f3511cfc71] ======================== Display plot restriction ======================== ---8<-------------------------------------
{ Display plot restriction v2.0 Restricts plot display to selected dates. ©Copyright 2005~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. http://www.metastocktools.com }
{ Sample plot to restrict } plot:=Mov(C,5,E);
{ Restrict date inputs } StDay:=Input("start Day",1,31,1); StMnth:=Input("start Month",1,12,1); StYear:=Input("start Year",1800,2200,2006); EnDay:=Input("end Day",1,31,31); EnMnth:=Input("end Month",1,12,3); EnYear:=Input("end Year",1800,2200,2006);
{ Selected date periods } 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));
{ Date signals } date1:=start AND Alert(start=0,2); date2:=end=0 AND Alert(end,2); date2:=Zig(end AND Cum(1)>1,1,$)=1;
{ Restrict out of range date signals to chart } start:= If(LastValue(Cum(date1))>0,date1,Cum(1)=1); end:=If(LastValue(Cum(date2))>0,date2, LastValue(Cum(1))=Cum(1));
{ Restrict plot to selected date period } pds:=LastValue(BarsSince(end)); restricted:= Ref(Ref(plot,-pds),pds)*ValueWhen(1,start,1);
{ Plot in own window } restricted
---8<-------------------------------------
[/code:1:f3511cfc71]
jose '-)
|