Back to Community
time of day dependence?

I was just goofing around with this algo, and set the trading time to mid-day. The results were relatively poor. Then I switched to one hour after open, and got this result. There seems to be a time-of-day dependence, although it demands more investigation.

Thought I'd share in case someone has insights, or would like to do some testing.

Grant

Clone Algorithm
746
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5553f4e2533d700c4e900b12
We have migrated this algorithm to work with a new version of the Quantopian API. The code is different than the original version, but the investment rationale of the algorithm has not changed. We've put everything you need to know here on one page.
There was a runtime error.
8 responses

@Grant,

This short research document may be of interest to you. I ran this many years ago, but was reminded of it by your post. In it I used proprietary software (where I used to work) to test many variations of the strategy which essentially answers the question of whether there time differential correlation in the markets. What is presented are only those scenarios which stood out.

https://dl.dropboxusercontent.com/u/217878013/Finance/TimeDifferential/index.html

Each image has the description of its particular run.

It's similar to your strategy only in that the time of day is the primary input for trading. I believe I've coded up similar strategies for folks here; time of day dependent algos.

Some algos have a legitimate time of day dependency, some have a data snooping bias that worsens, and some just have a random dependency on time of day. In my experience.

I'm new to Q, but have been looking at some of your postings. I've done algorithmic trading for about 1.5 years, without having encountered this platform previously.

I say that by way of introduction to indicate that for most stocks, I've also noted a huge volume difference in the first and last 15 or so minutes of the day versus otherwise. My instinct (never really proven like what you've shown) has been that folks take money off the table in terms of profits in those intervals, particularly if the opening price is a jump up from the last closing. As such, I've waited until 9:45am to place most trades on my screens, and it typically seems to work better than a 9:30 trade.

@Market TEch... may I ask... what is the name... of that proprietary software....? is that available in the market or just internally in your firm. .thanks...

http://www.4thstory.com/ is the company. They don't do retail.

One possibility is that this is an artifact of Quantopian's slippage model. It is quite punishing if you have the bad luck to put a relatively large order on on a small volume minute. I'd hypothesize that volumes tend to be less at mid-day than an hour after the open, hence you're getting hit by the slippage model more dramatically at mid-day than at the open?

I am new to Quantopian's famly. I try to implement the trading algorithm based on Market Tech's study.
However, my code seems not working well. I am wondering whether I miss anything in my code. Any comment and revision will be very appreciated.

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 56798d77c6fe001175a0f6b0
There was a runtime error.

If you flip the trading logic (buy vs sellshort) and still get a P&L curve like this, then you have a friction problem; slippage and commissions are overwhelming any profit that might exist.

You would also want to apply filters > .5% to buy, < -.5% to sell.

And nothing says that this mechanism should work... .