Get tomorrow's open

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Kaos
Posts: 71
Joined: 01 Mar 2006
Location: Australia
Has thanked: 3 times
Been thanked: 6 times

Get tomorrow's open

Postby Kaos » 17 Sep 2009

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

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Postby TJ » 17 Sep 2009

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

Kaos
Posts: 71
Joined: 01 Mar 2006
Location: Australia
Has thanked: 3 times
Been thanked: 6 times

Postby Kaos » 17 Sep 2009

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

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Postby TJ » 17 Sep 2009

I misunderstood what you want to do... please disregard my prev post.


Return to “User Contributed Studies and Indicator Library”