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 '-)
|