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

Re: [amibroker] Third Friday ?



PureBytes Links

Trading Reference Links

Brian,

You can not write Day() == (15 or 16 or 17 or 18 or 19 or 20 or 21 );
because operation in parentheses is executed first and
Day() is compared to the result of 15 or 16 or 17 or 18 or 19 or 20 or 21
which is True (1). This is so because OR is a logical operator
and non-zero value is interpreted as True so 
15 or 16 or 17 or 18 or 19 or 21 is interpreted
as True Or True Or True Or True Or True 
and gives True (1).

What you want achieve has to be coded in a following way:

Day() == 15 or Day() == 16 or Day() == 17 or Day() == 18 or Day() == 19 or Day() == 20 or Day() == 21;

Instead of such long statement it is better to write:

( Day() >= 15 AND Day() <= 21 )


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "saltyla1" <saltyla1@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 17, 2002 6:48 PM
Subject: Re: [amibroker] Third Friday ?


> Hello,
> 
> This is not tested, but maybe it will give you direction.
> On my calendar the second or fourth Friday
> will never fall on or between the days 15 and 21,
> but the third Friday will.
> 
> result=iif(DayOfWeek()== 5 ==
> day()==(15 or 16 or 17 or 18 or 19 or 20 or 21) and
> DayOfWeek()== (5 or 4 or 3),0,1);
> 
> Buy = MyRule AND result;
> 
> HaND,
> Brian
> 
> 
> ----- Original Message ----- 
> From: "kbennett99" 
> | 
> | Is it possible to code in AFL to avoid trades on the third Friday of 
> | each month AND the preceeding two days.
> | 
> | Something like:
> | 
> | Buy = MyRule AND DayOfWeek()!= 5;
> | 
> | but applied only to the third Friday (+ the preceeding 2 days if 
> | possible), not every Friday.
> | 
> | Keith (B)
> 
> 
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
>