[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] ROC since date - as an Explorer formula (not indicator formula)



PureBytes Links

Trading Reference Links

Hi, I have Jose Silva's formula below for building the ROC Since Date (or YTD) indicator. However, I still cannot figure out how to modify it into an explorer funtion such that my results are shown after I do an exploration for finding a list of stocks performance to date.

To elaborate, if I wanted to do an exploration from a list of 200 stocks, I remembered years ago something like I had to key in today's date against the date that I wanted to measure the returns against. After running the explorer, the ROC would appear in a column with the various returns of the various stocks and I can just sort the stocks according to the highest/lowest returns to date.


I had a working formula years ago in my older laptop for "YTD" and for "since date" that has since crashed. I've been trying fraustratingly to figure out the formula as an explorer function but I guess I'm just not smart enough to do it. I hope someone can help me.

I'm currently using metastock 10.1



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

---8<--------------------------






------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/