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

[amibroker] Any way to drag or change SHEET/Tab order?



PureBytes Links

Trading Reference Links

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




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/