I have a script that looks at a day's range and acts if it's a low-range day. But sometimes those low-range days are holidays -- 5/31/10 for example, when many futures markets were open but volume was very low -- and I end up taking trades I shouldn't. So in this case I would want to avoid trading on 6/1/10, the day after the holiday, and probably on the holiday itself.
Is there a way to know what days are holidays? I searched the forums and there was a Holiday Study (several incarnations) in WL4, but all links to it are dead and I don't see anything available for WL .NET. I'd do it myself but this is a nontrivial problem.
Thanks,
Gary
Size:
Color:
Whenever you see a dead link to an old version 4 discussion, just replace "www" in the url with "wl4" (WL4).
Which country's holidays are you interested in?
Size:
Color:
US Futures markets primarily. Others might be of interest eventually but US Futures is what I want for now.
Size:
Color:
In that case, it's very straightforward -
CODE:
Please log in to see this code.
The holidays come from the ..\Data\Markets.xml file. It's mostly forward-looking and the history is limited, but you could generate holiday dates and fill in what you need.
Size:
Color:
OK, thanks. That should work.
So is this documented anywhere? How would one find it without bugging you? Even knowing the name of it, I googled the site and searched the help and I didn't find anything about MarketInfo. It's not shown as one of the Bars components in the QuickRef and that's the only docs I can find about Bars.
Size:
Color:
MarketInfo is documented in the QuickRef. At least in version 6.
Size:
Color:
Eugene, I tried that code. It works on stocks but not on futures. I don't see anything in Markets.xml that limits it to stocks. The Name and Description fields imply the holidays apply to stocks, but how does it limit it to stocks? How do I get the holidays to work for futures markets?
Size:
Color:
Our unreleased (yet) tool called Market Manager can make this happen...
...but the data provider should explicitly support it.
Size:
Color:
QUOTE:
How do I get the holidays to work for futures markets?
How about grabbing a stock's Bars object with GetExternalSymbol?
Size:
Color:
Not ideal, but if you use a stock such as IBM and find a weekday with no data then you can guesstimate it's a holiday.
Size:
Color:
Dave, fritz is saying that the MarketInfo.Holidays method isn't working for futures. Assuming that is so, if you grab a Bars object from a stock, you can use it to test the date with the MarketInfo.Holidays method. It doesn't matter if the stock has a bar for that day or not. I argue it is nearly ideal. (Ideal would be that it worked for futures too.)
Size:
Color:
Hrm. Not very pretty but better than nothing. Thanks Cone!
Size:
Color:
I was saying that since futures (at least equities futures and usually bonds, energy, etc. futures too) trade on similar calendars so if you grab IBM and use the weekdays without prices as implied holidays that's generally good enough even if the date is far back enough you don't have a holiday returned from MarketInfo. That said I remember seeing a few years ago someone had compiled a list of market data events and was selling it. It was for use with tradestation but could be used with any product. I can dig up info (I think) if you can't find it.
Size:
Color: