Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Problem of Bollinger Band Strategy from Ernest Chan's book

I was trying to replicate the example 3.1 from Ernest Chan's book 'Algorithmic Trading: winning strategies and their rationale' in Quantopian. It's basically a pair trading using Bollinger band. I used the same pair (USO/GLD) and the same parameters as in the example and I think I coded it right (maybe I missed something), but I cannot replicate the good results in the example. My results are very poor and I cannot figure out why. Could anybody kindly help?

2 responses

Looks like you were really close, Chan adds a constant term when calculating the hedge ratio in his code. I only changed lines 19 & 20.

David

Thanks David, you helped a lot. It seems I didn't understand how to use the function sm.OLS, I need to look into this.