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

[EquisMetaStock Group] Year's Hi/Lo



PureBytes Links

Trading Reference Links

Try this MS indicator:

============
Year's Hi/Lo
============
---8<-------------------

{ Yearly High & Low v2.0

 ©Copyright 2005 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 }
yr:=Input("Year [1800~2200]",1800,2200,2004);
yrNr:=Input("Year:  [1]Selected,  [2]All",
 1,2,2);
plot:=Input("[1]Year's Hi/Lo,  [2]NewYear signals",1,2,1);

{ Start of year }
init:=Cum(1)=2;
nuYear:=Year()<>Ref(Year(),-1) OR init;

{ Highest/Lowest of year }
YearHi:=HighestSince(1,nuYear,H);
YearLo:=LowestSince(1,nuYear,L);

{ Restrict High to selected year }
xYrHi:=If(Year()=yr,YearHi,0);
xYrHi:=If(Year()>=yr,xYrHi,C);
xYrHi:=ValueWhen(1,xYrHi>0,xYrHi);

{ Restrict Low to selected year }
xYrLo:=If(Year()=yr,YearLo,0);
xYrLo:=If(Year()>=yr,xYrLo,C);
xYrLo:=ValueWhen(1,xYrLo>0,xYrLo);

{ Select: individual year's Hi/Lo or all years }
pYrHi:=If(yrNr=1,xYrHi,YearHi);
pYrLo:=If(yrNr=1,xYrLo,YearLo);

{ Plot on price chart }
If(plot=1,pYrHi,0);
If(plot=1,pYrLo,nuYear)

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


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




--- In equismetastock@xxxxxxxxxxxxxxx, wai <mwtang@xxxx> wrote:
>
> Many thanks for your explanation , i get more understanding about
> cum().
> Before receiving your code, i have been playing around with
> Highest(), lowest(),hhv() and llv(). Since I'm tring to find the
> highest and lowest value on a particular year. i have try :
>  If(year()=2004,highest(h),0) or if(year()=2004),lowest(l),0)
> Althrough a value have plot in-between the year 2004 but the value
> (highest or lowest ) is wrong, it does not plot the highest or
> lowest value between year 2004. It plot the highest or lowest value
> since the first day loaded in the chart.So I wonder is there any
> way to write code that can find the highest or lowest value/prices
> in a given  period (year).For example abc share have  highest  at
> $ 3.00 and  lowest at $ 0.90 in year 2004.
> Thanks You !
> 
> mun wai.
> 
> 
> 
> ----- Original Message -----
> From: "Jose Silva" <josesilva22@xxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Saturday, November 26, 2005 8:16 PM
> Subject: [EquisMetaStock Group] Re: explorer fomular ?
> 
> 
> init:=cum(1)=2;
> 
> This line of code finds the indicator's first valid signal (second
> price bar), to be used later in the ValueWhen() function seeding.
> Without this code "trick", the ValueWhen() will not plot anything
> (N/A, null) for the chart's first year.
> 
> cum(1)=2 becomes necessary (and not cum(1)=1) because the use of the
> Ref() function automatically makes the first plot unavailable (null)
> thereafter.
> 
> Another choice would be:
> init:=cum(IsDefined(nuYear))=1;
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, wai <mwtang@xxxx> wrote:
>
> Many thanks for your help. But I have some confuse in one of the
> line :
>
> init := cum(1) = 2 ;
>
> Could you please exlain. Thank in advance.
>
> mun wai.
>
>
> ----- Original Message -----
> From: "Jose Silva" <josesilva22@xxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Friday, November 25, 2005 10:23 AM
> Subject: [EquisMetaStock Group] Re: explorer fomular ?
>
>
> Try this:
>
> MetaStock -> Tools -> Indicator Builder -> New ->
> Copy and paste complete formula between "---8<---" lines.
>
> ===============
> Yearly % change
> ===============
> ---8<-----------------------
>
> { Yearly % change in price }
>
> { ©Copyright 2005 Jose Silva.
>   For personal use only.
>   http://www.metastocktools.com }
>
> { User inputs }
> yr:=Input("% change for Year [1800~2200]",
>  1800,2200,2000);
> yrNr:=Input("Year:  [1]Selected,  [2]All",
>  1,2,1);
> plot:=Input("plot:  [1]% Change,  [2]New Year markers",1,2,1);
>
> { Start of year }
> init:=Cum(1)=2;
> nuYear:=Year()<>Ref(Year(),-1) OR init;
>
> { Data Array }
> x:=C;
>
> { Year's % change }
> ch:=(x/ValueWhen(1,nuYear,x)-1)*100;
> chYear:=If(Year()=yr,ch,0);
> chYear:=ValueWhen(1,chYear<>0 OR init,chYear);
>
> { Select individual year's % or all }
> chPer:=If(yrNr=1,chYear,ch);
>
> { Plot in own window }
> If(plot=1,chPer,nuYear)
>
> ---8<-----------------------
>
>
> ==================
> Exploration filter
> ==================
> ---8<-------------------------
> { Uses default settings in "Yearly % change" indicator }
> change:=200;  {min % change for default year }
> Fml("Yearly % change")>=change
> ---8<-------------------------
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, wai <mwtang@xxxx> wrote:
>
> I would like to write an explorer fomular that can scan stocks that
> had rise more than 200% on a particular year.
> For example : ABC share rise more  than 200% from its low in 2000.
> I have try :
>
> year()= 2000 and hhv(h,200) - ref(llv(l,200),-1) >= 2*ref(llv(l,200
> ),-1)
> But it does not work. I hope someone can help.
> Thanks !
>
> mun wai.







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