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

Re: first/last days not mon/fri



PureBytes Links

Trading Reference Links

Further work on this makes me think the best way to do
it is to just have the strategy trade weeks with all
five days, and to test on Monday whether this week is
one of those weeks.  So now I need to build a 'weekok'
function that will exclude weeks with a holiday.  Has
anyone built/got a holiday calendar with some serious
history?  If not, if others are interested, we could
split up work and build one.

b
--- "Brian J. Haag" <brian_haag@xxxxxxxxx> wrote:
> 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
> 


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