java date operations and trading calendar

Adamus

Experienced member
Messages
1,898
Likes
97
Hi

does anybody have a Java class that they'd be prepared to share, for doing date calculations, particularly taking into account the trading calendar?

Specifically, I am trying to calculate the number of days, hours, mins etc between 2 trades, and I need to specify futures exchange business days - so from Friday noon to Monday noon is 1 day, not 3.

Thanks
Adam
 
Thanks for the link, appreciated. It's good to see some other system traders around here.
 
Not sure what you mean unless you mean everything.

Futures markets. Looking to put together a basket of markets to trade one system.

Currently have a short-term break-out system that trades with stops to enter and MOC to exit. I figured I should prove myself with end-of-day data before moving on to tick data.

I understand the market on close orders are also known as "murder on close" because of the poor fills, but as yet I haven't got to the point of trying it out yet. Maybe the slippage will murder my results, but my back-testing says it should work.

I put together my system with Easy Language on TradeStation and will trade it manually on IB.

Currently I'm pretty busy trying to work out the correlation of the different markets in my basket so I can try to reduce the variance in my returns over the whole portfolio. Before you tell me though, yes I know that volatility is increasingly correlated across all markets!
 
The problem with proving or disproving with end of day data is that in practice you are trading intraday...

What is the solution ? Some people say to use the daily OHLC, but this leads to a completely false test as you then exit on the L/H BUT this is silly, since you only know it was the L/H by the Close. Hence not much better than testing on the close.

I saw you were asking for java class/library but your post says you are using Tradestation...I did not know TS supported Java. My personal opinion of TS is not very high at all...I know it used to be fantastic 8+ years ago.

Are you developing auto trading systems in Java ?
 
I output the trades from TradeStation as csv files and input them into my own Java app which analyses the trade history and produces stats.

There's another guy around here who developed a trading system to trade via InteractiveBrokers' API which sounded great. I might do that in the future but at the moment I find TS lets me code trading systems happily enough.

I'm using TS4 which I bought ten years ago. I used it over 2 consecutive periods in anger (both without success, but that was not the software's fault).

I appreciate your comments on the anomalies of end-of-day data - I think you're talking about the problem of having 2 orders filled in one day? It sometimes happens, and TS take the most pessimistic approach to filling them.

e.g. if I have a buy stop above the open for break-out long, and a sell stop below for break downwards, I could get filled twice. TS gives me one fill going long from the buy stop, reverses the position at the sell stop, thus opening a short position from the sell stop, leaving me short at the close of the market (or the close of the bar if using intra-day). Or the other way around if the profit is worse.
 
Last edited:
Top