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 : Tuesday, July 25, 2006 8:08:25 AM(UTC)
ageitalia

Rank: Advanced Member

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

Thanks: 6 times
I'm looking for the correct code by which to compare today's close with that of a fixed (always the same) date in the past. E.g., plotting an indicator showing each day the RoC referred to October 13, 2005, close. Each day the RoC time frame adds one day, so I would like to say to my custom indicator: "hei, take today's close, and calculate the % RoC with the close of Oct 13, 2005". Would it be possible?
Jose  
#2 Posted : Tuesday, July 25, 2006 9:36:07 AM(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)
Try this "RoC since date" indicator: [code:1:3303872ef5] { Rate of Change (RoC) since past date v1.0 ©Copyright 2005-2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } StDay:=Input("Day",1,31,1); StMnth:=Input("Month",1,12,1); StYear:=Input("Year",1800,2200,2006); method:=Input("method: [1]%-percent, [2]$-points",1,2,1); plot:=Input("plot: [1]RoC, [2]Date signal", 1,2,1); { Data array } x:=C; { Event date's signal } date:=Year()>StYear OR (Year()=StYear AND (Month()>StMnth OR Month()=StMnth AND DayOfMonth()>=StDay)); event:=date AND Alert(date=0,2); { Event's Close value } start:=Cum(IsDefined(event))=1; eventVal:=ValueWhen(1,event OR start,x); { RoC since chosen event } RoCper:=(x/eventVal-1)*100; RoCpts:=x-eventVal; { Select % or $ method } eventRoC:=If(method=1,RoCper,RoCpts); eventRoC:=If(date,eventRoC,0); { Plot in own window } If(plot=1,eventRoC,event) [/code:1:3303872ef5] jose '-)
ageitalia  
#3 Posted : Tuesday, July 25, 2006 10:01:17 AM(UTC)
ageitalia

Rank: Advanced Member

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

Thanks: 6 times
Well, this is close to what I was looking for (nice formula, BTW), but doesn't match perfectly my purposes. To be precise, I would like to build an "index number". So, take an equity index like the SPX, whose Oct. 13 closing low was 1176.84. Yesterday close was 1260.91. I would like to plot an indicator showing "100" as Oct. 13 data, and 107.14 ad yesterday close. It's a kind of RoC indicator, but in this way I'm able to compare with other securities/indices. Obviously, the formula should ask me to insert the "zero date" data. Additionally, I would insert the security ticker symbol directly into the code, in order to create different "zero based" indices, and occasionally subtract/multiply them. Many, many thanks for you co-operation.
Jose  
#4 Posted : Tuesday, July 25, 2006 10:51:45 AM(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)
Mmmm... sounds like you may be looking for something along the lines of the URSC tool-kit, Ageitalia. It does precisely the comparison you suggest. jose '-)
wabbit  
#5 Posted : Tuesday, July 25, 2006 11:30:53 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I am pretty sure that Jose has this one covered, but this might be another possible solution? --8<----------------------------- dd:=Input("Day",1,31,13); mm:=Input("Month",1,12,10); yy:=Input("Year",1901,2099,2005); x:=Input("[1]Open [2]High [3]Low [4]Close",1,4,4); x:=(x=1)*O + (x=2)*H + (x=3)*L + (x=4)*C; start:=Year()>yy OR (Year()=yy AND (Month()>mm OR Month()=mm AND DayOfMonth()>=dd)); pr:=ValueWhen(1,start AND Alert(start=0,2),x); (x/pr)*100; --8<----------------------------- On the start day, the indicator has a value of 100, and then you monitor the "percentage" change from this value... I hope it helps, wabbit :D
ageitalia  
#6 Posted : Tuesday, July 25, 2006 2:10:23 PM(UTC)
ageitalia

Rank: Advanced Member

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

Thanks: 6 times
wabbit wrote:
I am pretty sure that Jose has this one covered, but this might be another possible solution?
They both work well. Many thanks for your kindness!
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.