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

first/last days not mon/fri



PureBytes Links

Trading Reference Links

Copied from TradeStationWorld, where it appears to be
not interesting enough:

Let's say you want to buy the close of the first day
of the week, and sell the close of the last day of the
week. It would be easy if these days were always
Monday and Friday, but of course that's not the case.
So I'm trying this:

vars: dw( 1),
nd( 1),
ndw( 1),
fdw( false),
ldw( false) ;

dw = dayofweek( date) ;
nd = date next bar ;
ndw = dayofweek( nd) ;

fdw = dw = 1 or dw[1] = 5 ;
ldw = dw = 5 or ndw = 1 ;

if fdw then buy this bar close ;
if ldw then setexitonclose ;

To no avail.

Anyone solved this?

b

=====
Brian J. Haag
brian_haag@xxxxxxxxx