logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ageitalia  
#1 Posted : Wednesday, July 26, 2006 10:54:26 AM(UTC)
ageitalia

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 6/16/2006(UTC)
Posts: 47
Location: Italy

Thanks: 6 times
Take a security, whose you plot the latest 100 bars. Then you plot a 20 days moving average and a 14 days RSI. Well, it would be interesting to add a "show plotting since" function, in order to show on the chart just a fraction of various indicatos chosen. Sometimes plotting different MAs and indicators could add some troubles and confusion; so it would be great to show 14-d RSI and 25-d MA for the latest 50 bars only, if requested by the user.
hayseed  
#2 Posted : Wednesday, July 26, 2006 2:48:06 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey ageitalia.... you can plot from certain dates fairly easily..... the quick code below, with vast room for improvement, will plot rsi from date of your choosing.... same principle can be applied to moving averages..... wabbits dll will help on the ma's...... the date uses last 2 digits for year.... so feburary 28, 2006 would be input as 060228 or 60228...... h [code:1:a8e5f37437]startdate:=Input("start plot date yymmdd",010101,101231,060403); pds:=input("rsi periods",2,20,5); date:=(Year()-2000)*10000 + Month()*100+ DayOfMonth(); 30;50;70; If(date>startdate,RSI(pds),50)[/code:1:a8e5f37437]
Jose  
#3 Posted : Wednesday, July 26, 2006 10:09:22 PM(UTC)
Jose

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)
This "Display plot restriction" indicator is a code example for restricting output to a specific date range: [code:1:c429ee2f50] {Restricts plot display to selected date period. ©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:=RSI(14); { 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 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))); { Start/End signals } start:=start AND Alert(start=0,2); end:=PeakBars(1,period OR Cum(1)=2,1)=0; { Restrict plot to selected date } pds:=LastValue(BarsSince(end)); restricted:= Ref(Ref(plot,-pds),pds)*ValueWhen(1,start,1); { Plot in own window } restricted [/code:1:c429ee2f50] jose '-)
thanks 1 user thanked Jose for this useful post.
Ujjwal on 5/2/2017(UTC)
ageitalia  
#4 Posted : Thursday, July 27, 2006 9:43:15 AM(UTC)
ageitalia

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 6/16/2006(UTC)
Posts: 47
Location: Italy

Thanks: 6 times
Jose wrote:
This "Display plot restriction" indicator is a code example for restricting output to a specific date range:
Bravissimo!!! and it can work with different indicators! A very good work, just I suppose this task may be inserted in a future release of our beloved program... Grazie ancora P.S.: A little note: there's only a small bug in the code: it doesn't take into account the latest bar. The "end day" has to be the next to last bar (daily, weekly, etc.
Jose  
#5 Posted : Thursday, July 27, 2006 10:50:08 PM(UTC)
Jose

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 '-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.