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

Re: [amibroker] OR operator



PureBytes Links

Trading Reference Links

Hello,

The second version simply makes no sense.

The first is executed as follows (I added parentheses to show the order):
Sell=  (SellPrice==bestlong) OR (TimeNum()==190000);
Cover = (CoverPrice==bestshort) OR (TimeNum()==190000);

and it makes sense.

The second version executes like this:

Sell = ( ( SellPrice == TimeNum() ) == 190000 ) OR bestlong ;
Cover= ( ( CoverPrice == TimeNum() ) ==190000 ) OR bestshort;

and it makes no sense because it attempts to match price to time,
then boolean result of such comparison to a number 190000 and
at the end it is all ORed. 

The precedence table is here:
http://www.amibroker.com/guide/a_language.html

As you can see "equal to" operator has higher precedence than OR
and for that reason executed before OR-ing.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "qweds_560" <qweds_560@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, January 23, 2005 4:12 PM
Subject: [amibroker] OR operator


> 
> 
> Hello,
> 
> Can someone please tell me why I receive different results in the 
> backtester when using:
> 
> Sell=SellPrice==bestlong OR TimeNum()==190000;
> Cover=CoverPrice==bestshort OR TimeNum()==190000;
> 
> and using:
> 
> Sell=SellPrice== TimeNum()==190000 OR bestlong ;
> Cover=CoverPrice== TimeNum()==190000 OR bestshort;
> 
> (all I have done is to swap the timenum part with the bestlong 
> variable).
> 
> Thanks
> 
> Sam
> 
> 
> 
> 
> 
> 
> 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 --------------------~--> 
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
--------------------------------------------------------------------~-> 

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/