PureBytes Links
Trading Reference Links
|
Johsun, thanks for this code. I have been using ref(hhv,n),-1) in a
similar way. I will probably switch to your method. I will study it more
later. It will probably allow me to be more creative that my current method
allows. Ron D
----- Original Message -----
From: "johsun" <johanskatt@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, June 26, 2004 10:45 AM
Subject: [amibroker] Re: HighestSince function
> Slightly modified so that it returns EMPTY value when there is no
> prior occurence.
>
> function HighestBetween(expression,array,n)
> //Returns the highest ARRAY value between the Nth most recent
> //occurrence of True EXPRESSION AND the one prior to that.
> {
> e=expression;a=array;
> Hb=IIf(n>0,ValueWhen(e,Ref(HighestSince(e,a,1),-1),n),
> HighestSince(e,a));
> return IIf(n>LastValue(Cum(e))-1,Null,LastValue(Hb));
> }
>
> Johan
>
> --- In amibroker@xxxxxxxxxxxxxxx, "johsun" <johanskatt@xxxx> wrote:
> > You can write a function for that,
> >
> >
> > function HighestBetween(expression,array,n)
> > //Returns the highest ARRAY value between the Nth most recent
> > //occurrence of True EXPRESSION AND the one prior to that.
> > {
> > e=expression;a=array;
> > Hb=IIf(n>0,ValueWhen(e,Ref(HighestSince(e,a,1),-1),
> > Min(LastValue(Cum(e)),n)),HighestSince(e,a));
> > return LastValue(Hb);
> > }
> >
> >
> > //example of use
> > Cond=Cross(MACD(),0);
> > Occ=Param("occ",0,0,8);
> > x=HighestBetween(Cond,H,Occ);
> >
> > GraphXSpace=4;
> > Plot(C,"",colorDefault,styleBar);
> > Plot(Cond,"",colorRose,styleHistogram|styleOwnScale|styleNoLabel);
> > Plot(x,"",colorRed,styleLine);
> >
> > Regards,
> > Johan
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|