Page 1 of 1

Get tomorrow's open

Posted: 17 Sep 2009
by Kaos
Hi All,

I want to find out what happens on a particular day. Eg: are Monday's up or down?

Normally I would write a system

If DOW(today) = Friday then buy next bar on open.
Exitlong MOC

The problem is if Monday is a holiday then the results would include some Tuesday data.

I want to create a system where....

If lastbaronchart = false then begin {so I don't produce an error on the last bar}
If DOW(tomorrow) = monday then buy tomorrow's open
Exitlong @ tomorrow's close

How would I code this up?

Regards,
Paul

Posted: 17 Sep 2009
by TJ
DayOfWeek will give you the "Monday" information.

not sure about the "tomorrow" part.


since this is a backtest, you don't have to worry about lastbaronchart.


you can try this: (pseudo code)

Code: Select all

If DOW(yesterday) = monday then buy today at market
Exitlong @ MOC

Posted: 17 Sep 2009
by Kaos
Hi TJ,

Thanks heaps for the reply but that code will still give the same result

If DOW(yesterday) = 5 then buy today

But if monday is a holiday then today will be a Tuesday.

I'll keep checking and post a solution if I find one

Cheers
Paul

Posted: 17 Sep 2009
by TJ
I misunderstood what you want to do... please disregard my prev post.