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

[amibroker] Re: need any 3 of 4 conditions to be true



PureBytes Links

Trading Reference Links

Yuki,
As we have already discussed in the past, conditions are binary, 
equal to 1 [when true] and 0 [when false].
Cond1 = whatever;
Cond2 = wherever;
Cond3 = whomever;
Cond4 = however;

filter = Cond1+Cond2+Cond3+Cond4==3;
is equivalent to your " *any* 3 of the 4 above to be true ".
The sum will be
1+1+1+0 or
1+1+0+1 or
1+0+1+1 or
0+1+1+1, in other words always equal to 3.

Dimitris
--- In amibroker@xxxxxxxxxxxxxxx, Yuki Taga <yukitaga@xxxx> wrote:
> If I define four conditions, how can I write a filter statement 
that returns
> issues where *any* 3 of the 4 conditions are true?
> 
> For example:
> 
> Cond1 = whatever;
> Cond2 = wherever;
> Cond3 = whomever;
> Cond4 = however;
> 
> filter = (need *any* 3 of the 4 above to be true);
> 
> I think I could eventually get this done myself, but I suspect the
> result would make a programmer roll on the floor with laughter.  The
> only way I can think of to do it would be *really* long.  There must
> be a compact way of doing this, isn't there?
> 
> Yuki



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