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

[EquisMetaStock Group] Re: Yearly % change



PureBytes Links

Trading Reference Links

JD, by default the Yearly RoC indicator will always return the current 
YTD RoC %.  If you change the exploration date to a specific past 
date, then it will return that year's YTD RoC %.

This can be changed in the user-input section, to display only one 
specific year if needed.

Plot the indicator below any chart, and it will answer all your 
questions.


jose '-)
http://www.metastocktools.com }



--- In equismetastock@xxxxxxxxxxxxxxx, "John Doe" <ms001122@xxxx> 
wrote:
>
> Jose,
> 
> Thanks for making those changes. By the 1st part of my Q:
> -------------
>> 1) Is it possible to set it up such that it will automatically give
>> the YTD % chnage value based on the date of the last bar (be it in
>> a chart or in an exploration)?
> -------------
> what I meant was:
> - when the next year rolls around, will it automatically generate
> the YTD % change values for the (then) current year or will one have
> to manually go in and set the value in 'Input'?
> - also, while testing it in an Exploration with an end-date set not
> to the last bar but to some point in the past (say, Dec. 6, 1999),
> will it give the YTD % change value for the current year (currently
> 2005) or to the last date set in the exploration (e.g. 1999)?
> 
> JD
> ===================
> 
> From: "Jose Silva" <josesilva22@xxxx>
> Reply-To: equismetastock@xxxxxxxxxxxxxxx
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: [EquisMetaStock Group] Re: Yearly % change
> Date: Sun, 25 Dec 2005 07:29:39 -0000
> 
> JD, I don't understand your first question, as the code currently
> plots the YTD % change by default.
> 
> As for the null plot in charts without a full year's data,
> unfortunately the hindsight trick that allows for the determining of
> the last day of the previous year, also prevents any plot within the
> first three bars.  The code below takes care of the first incomplete
> year of data, starting from the fourth bar of data.
> 
> ==========
> Yearly RoC
> ==========
> ---8<-----------------------------
> 
> { Yearly Rate of Change (RoC) v4.1
>    Incomplete year begins on 4th data bar.
> 
> ©Copyright 2004~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 }
> method:=Input("Method:  [1]%percent,  [2]$points",1,2,1);
> yr:=Input("RoC for Year [1800~2200]",
>   1800,2200,2004);
> yrNr:=Input("Yearly RoC:  [1]Year,  [2]Yearly,  [3]Historical",1,3,
2);
> plot:=Input("plot:  [1]RoC,  [2]Year signals",
>   1,2,1);
> 
> { Start/End of year }
> nuYear:=Year()<>Ref(Year(),-1) OR Cum(1)=2;
> YearEnd:=PeakBars(1,-(nuYear OR
>   Cum(IsDefined(nuYear))=1 OR Cum(1)=4),1)=0;
> init:=Cum(IsDefined(YearEnd))=1;
> 
> { Data Array }
> x:=C;
> 
> { Yearly $ RoC change }
> chPts:=x-ValueWhen(1,YearEnd,x);
> chPts:=If(YearEnd=0,chPts,
>   Ref(chPts,-1)+x-Ref(x,-1));
> 
> { Yearly % RoC change }
> chPer:=(x/ValueWhen(1,YearEnd,x)-1)*100;
> chPer:=If(YearEnd=0,chPer,
>   Ref(chPer,-1)+(x/Ref(x,-1)-1)*100);
> 
> { Select %/$ RoC method }
> ch:=If(method=1,chPer,chPts);
> 
> { Restrict RoC to selected year }
> chYear:=If(Year()=yr,ch,0);
> chYear:=If(Year()=yr,chYear,
>   ValueWhen(1,
>    init OR YearEnd AND Year()=yr,chYear));
> 
> { Historical RoC from beginning of chart }
> chAllPts:=x-ValueWhen(1,Cum(1)=1,x);
> chAllPer:=(x/ValueWhen(1,Cum(1)=1,x)-1)*100;
> 
> { Select %/$ historical RoC method }
> chAll:=If(method=1,chAllPer,chAllPts);
> 
> { Select type of Yearly RoC }
> YearRoc:=If(yrNr=1,chYear,If(yrNr=2,ch,chAll));
> 
> { Plot in own window }
> If(plot=1,YearRoc,nuYear-YearEnd)
> 
> ---8<-----------------------------
> 
> 
> jose '-)
> http://www.metastocktools.com








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> 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/