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

Re: [amibroker] Value InBetween



PureBytes Links

Trading Reference Links

this code is courtesy of group member whose id in the
group is johsun:

//*********************************************//
function HighestBetween(_expression,array,n)
{
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);
}
//*********************************************//

function LOWESTBetween(_expression,array,n)
{
e=_expression;a=array;
Hb=IIf(n>0,ValueWhen(e,Ref(LowestSince(e,a,1),-1),
    Min(LastValue(Cum(e)),n)),LowestSince(e,a));
return LastValue(Hb);
}

//**********MACD CONDITION DEFINITION*********//

X_UP=Cross(MACD(),0);
X_DN=Cross(0,MACD());
Occ=Param("occ",0,0,10);

You can define any condition where it says macd
condition definition. Then use it as under:

LO1=LOWESTBetween(X_DN,L,0  );
LO2=LOWESTBetween(X_DN,L,1  );

HI1=HIGHESTBETWEEN(X_UP,H,0  );
HI2=HIGHESTBETWEEN(X_UP,H,1  );

This gives the value of the highest hi and the lowest
lo made when the conditions were true. 

This however does not give you the value of the
barnumber when such highs and lows were made. I did
try to sort that on my own but I am severely
programming challenged and failed miserably. I  also 
approached AB support numerous times to help me sort
that out but to no avail. 


HTH

Rakesh


--- Graham <kavemanperth@xxxxxxxxx> wrote:

> Just add the conditions as you want them
> 
> eg
> 
> bar1 = 2000;
> bar2 = 1500;
> bar3 = 1400;
> 
> RangeHHV = iif( selectedvalue( barindex() )==bar1,
> ref( HHV( C,
> bar2-bar3+1 ), bar2-bar1 ) , null );
> 
> there are other ways, this is just one
> 
> On 6/15/05, jay_podda <jay_podda@xxxxxxxxx> wrote:
> > How can I find value from any array when some
> condition is valid
> > inbetween some range? I want to find HHV of close
> inbetween barindex
> > 1400 and 1500, when total barcount is 2000(say
> when my
> > lastvalue(barindex()) is 2000 or
> selectedvalue(barindex()) is 2000).
> > 
> > 
> > 
> > 
> > 
> > Please note that this group is for discussion
> between users only.
> > 
> > To get support from AmiBroker please send an
> e-mail directly to
> > SUPPORT {at} amibroker.com
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Cheers
> Graham
> http://e-wire.net.au/~eb_kavan/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/