Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Buy On Gap with shorts. Please Critique.

I implemented the buy on gap strategy from Ernest Chan's Algorithmic Trading book (or as close as I could get it). From 2003 to 2020 it made 189,000% which is about 50% annualized (check my math). The max draw-down was just under -50%, which I didn't like.

I tried shorting an equal dollar amount of stocks matching the opposite criteria. That got the max draw-down to around -35%, but the total return dropped to 1,370%. That's a huge difference.

Finally, I did a long/short strategy but I don't balance it. There may be days with only longs or only shorts. I am back to the -50% draw-down, but total returns are 2,931,986% which is about 88% annualized (check my math). This is the back-test in the post.

I find it hard to believe that something this simple did that well. It's from a well known book, with minimum modifications. I must be missing something.

Critique me.

5 responses

@Don,

All hypotetical returns in this backtest come from two lines:

    set_slippage(slippage.FixedSlippage(spread=0.0))  
    set_commission(commission.PerShare(cost=0.00))  

On last day 2020-05-07 transactions you can find:

6.32 AM LYFT SELL $30.38 -67896775 ($2.062.704.024.50)

Nobody, nowhere in real trading can trade $2.062.704.024.50 (20% of Market Capitalization of LYFT)
in a single minute with no slippage and no comissions.

So first comment those two lines and run algo again.
I hope you will publish it here.

Be realistic.

Thanks. I forgot I even had those. I always start like that to get going and then remove them. I'll do it now and post it.

Thanks Vladimir.
Once I commented these lines out it behaves more as expected.

@Don, as @Vladimir has pointed out, commenting out those two lines of code changes the picture considerably.

I also commented out the slippage and commissions lines as @Vladimir did, and increased the initial stake to $1 M. It is not a pretty picture.

I would add that the strategy is not that scalable either.

Depends on the context. A strategy does not necessarily need to be judged on its stand-alone merits. In a signal-combination setting slippage matters less.

Try running an alpha decay tearsheet. https://www.quantopian.com/posts/an-updated-method-to-analyze-alpha-factors#5d5d30ec52116e004cae4bef