Back to Community
End of the day run strategy

Hi Quantopian-user,

i played around with my algorithm for a while and figured out that there is a high probability for SPY to decline in the last 15 minutes before market close. I put that in an algorithm and the results are quite remarkable. Feel free to comment and play ;)

Clone Algorithm
42
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: 589c84550d17225e0561fcc8
There was a runtime error.
10 responses

I guess you just need a shit load of leverage to outperform the market.

adding any sort of leverage crashes the algo, so don't see how you will be able to outperform the market

Its technical leverage never exceeds 1.00.
Risk is 157% of initial capital though since the shorting goes that high.

2017-02-06 13:00 _pvr_:166 INFO PvR 0.0094 %/day   cagr 0.0   Portfolio value 1559106  
2017-02-06 13:00 _pvr_:167 INFO   Profited 559106 on 1571383 activated/transacted for PvR of 35.6%  
2017-02-06 13:00 _pvr_:168 INFO   QRet 55.91 PvR 35.58 CshLw 970857 MxLv 1.00 RskHi 1571383  

Note that the existence of handle_data (merely contains 'return') would mean that Python must check to see whether there is any work to do there, 390 times (minutes) per day. The algo runs fast, only 1.5 minutes, however it would be faster with that commented out, 1.2 minutes, a gain of only 18 seconds yet 20%.

Anyway, thanks for sharing that last 15 minute SPY info, glad I know.

@Blue: What do you mean by 1.5 minutes?

Yes, its just a very easy basic start. Its quite interesting that such effect exist. There is a momentum in both ways, long and short, (see backtest analysis tearsheet and compare the gains in the crisis of 2008). Im working on filters like day of the week where the effect occurs mostly or maybe the effect occurs if the overall trend in daily mode is bullish for going short at 15.45pm (and vice versa).

Loading notebook preview...
Notebook previews are currently unavailable.

I am curious about exiting positions at market close. I would have thought that you would want to submit an order to close them out a couple of minutes before the market closes in order to make sure they get filled. Does anyone have any experience with live trading on a schedule function that executes trades at market close?

Another interesting thing to try would be to sell Volatility (buy XIV) on Friday Afternoon's and sell it on Monday morning.

Here is my research notebook so far.
You can play with time periods and expand the research. The main insight is the major decline in the last 15-20 minutes before market close. I referred to SPY but of course you can take the same setting for other stocks to study the phenomena.

Loading notebook preview...
Notebook previews are currently unavailable.

I've noticed that the SP tends to open in the green and make the largest gains in the first half hour of trading; perhaps you combine this with the strategy above to produce a strategy with higher returns and Sharpe?

i just changed some parameters and use the Dow Jones as Benchmark. Further i included some leverage and close out the position 2 minutes before market close.

Clone Algorithm
42
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: 58b01c0df087f761c813c6d1
There was a runtime error.

is it possible to construct a frequency distribution for this time period?