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

Re: [amibroker] numeric values in boolean expressions



PureBytes Links

Trading Reference Links




Hello,
 
Yes. Exactly like in C.
However there is one caveat in this approach.
 
If you write 
my_variable = 5;
 
you can use
buy = my_variable;
 
and it will be interpreted as "true" value and it will give a 
buy signal every bar.
 
But if you write
 
buy = my_variable == True;
 
It won't because True constant has a numerical value of 1 and 
my_variable is 5 and 1 != 5
 
For that reason one should be very careful when mixing 
numerical and boolean statements
(in C/C++ it works the same)
Best regards,Tomasz 
Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=jcasavant@xxxxxxxxxxxx 
  href="">Jayson 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, February 10, 2003 9:43 
  PM
  Subject: RE: [amibroker] numeric values 
  in boolean expressions
  
  <SPAN 
  class=352323820-10022003>Tomasz,
  If I 
  follow you,  a value less than zero would also be interpreted as true,so 
  in the example below the two versions of fromlongtoshort would not be 
  equivalent. Is that correct?
   Jayson 
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Tomasz Janeczko 
  [mailto:amibroker@xxxxxx]Sent: Monday, February 10, 2003 3:31 
  PMTo: <A 
  href="">amibroker@xxxxxxxxxxxxxxxSubject: 
  Re: [amibroker] numeric values in boolean expressions
  Hello,
   
  In fact numeric values can be treated as booleans as in 
  C.
  Zero is interpreted as False, any non zero value (except 
  empty/null)
  is treated as True.
  Best regards,Tomasz 
  Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    <A title=jcasavant@xxxxxxxxxxxx 
    href="">Jayson 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Monday, February 10, 2003 8:39 
    PM
    Subject: RE: [amibroker] numeric values 
    in boolean expressions
    
    It 
    depends if the variable yesterdaylongpercent is a true/false variable. For 
    example;
    <SPAN 
    class=935453319-10022003> 
    <SPAN 
    class=935453319-10022003>x=c>ma(c,50);  x is either true (1) or 
    False (0)
    <SPAN 
    class=935453319-10022003> 
    <SPAN 
    class=935453319-10022003>x=ma(c,50);   x is a variable number and 
    can not be equated to true or false.
     Jayson 
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: Steve Davis 
    [mailto:sdavis@xxxxxxxxxxxxx]Sent: Monday, February 10, 2003 2:13 
    PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
    numeric values in boolean expressionsCan numeric 
    values be used in a boolean expression?For example, are the following 
    two lines of code equivalent?fromLongToShort = (yesterdayLongPercent 
    > 0 AND todayShortPercent > 0);fromLongToShort = 
    (yesterdayLongPercent AND todayShortPercent);I am unable to try a 
    quick test at the moment.Thanks,-StevePost 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Post AmiQuote-related messages ONLY to: 
    amiquote@xxxxxxxxxxxxxxx (Web page: <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT  









Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.