PureBytes Links
Trading Reference Links
|
Huseyin, the easiest solution woud be to create the signal and then
measure the RoC% from it to today.
Examples:
===============
RoC since event
===============
---8<--------------------------
{ Rate of Change (RoC) since past event v1.0 }
{ ©Copyright 2005-2007 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 }
choose:=Input("event: [1]Week, [2]Month, [3]Year, [4]User-
defined",1,5,3);
method:=Input("method: [1]%-percent, [2]$-points",1,2,1);
plot:=Input("plot: [1]RoC, [2]Event signals",
1,2,1);
{ Event1 - start of Week }
event1:=DayOfWeek()<Ref(DayOfWeek(),-1);
{ Event2 - start of Month }
event2:=DayOfMonth()<Ref(DayOfMonth(),-1);
{ Event3 - start of Year }
event3:=Year()<>Ref(Year(),-1);
{ Event4 - EMA crossover signals example }
event4:=Cross(Mov(C,5,E),Mov(C,21,E));
{ Event5 - LinReg crossover signals example }
event5:=Cross(LinearReg(C,5),LinearReg(C,21));
{ Choose event }
event:=
If(choose=1,event1,
If(choose=2,event2,
If(choose=3,event3,
If(choose=4,event4,
event5))));
{ Event's Close value }
start:=Cum(IsDefined(event))=1;
eventVal:=ValueWhen(1,event OR start,C);
{ RoC since chosen event }
RoCper:=(C/eventVal-1)*100;
RoCpts:=C-eventVal;
{ Select % or $ method }
eventRoC:=If(method=1,RoCper,RoCpts);
{ Plot in own window }
If(plot=1,eventRoC,event)
---8<--------------------------
==============
RoC since date
==============
---8<--------------------------
{ 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<--------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, huseyinturcan <no_reply@xxx> wrote:
>
> Dear All,
>
> I use BarsSince function to check the occurence period of a certain
> condition with EOD and weekly data. I want to check ROC since the
> period that condition occured upto today, but could not achive to use
> it. In fact the form is such as;
>
> ROC(C,%,BarsSince(condition)) but it did not work. An error message
> occured when I tried to formulise it
>
> I will appreciate a lot if anybody helps me to formulise the condtion
> correctly
>
> Thanks and Regards
>
> Huseyin
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/
|