Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
What is going on with this algo?

So I was fooling around with this "corrected" ewma, trying to do a sort of mean reversion. It has a huge draw down and then huge returns, with a low sharpe. Why does this work? As you can see it's basically exactly anti correlated with twitter after the crash, which leads me to believe I've just accumulated a huge short position by chance before twitter's crash... Thoughts?

2 responses

Jason, it looks like your algo does end up with a pretty big short position leading into the pull back. It does a nice job of tapering of afterward too.

One thing I saw is that your order_possible function doesn't actually get called. You ask, 'if order_possible,' which evaluates to True because the function does exist. If it did get called you might want to use an absolute value to check against as well, the negative shares will mean your cash will probably always be more than the price * shares.

I noticed the function call after I ran this test, but this plots your shares and cash. Should help get a better idea of how it's behaving. It looks like the idea holds water though.

David

Oh yes... I actually realized my mistake earlier this morning and have since fixed the order_possible call. Unfortunately, that huge short position is not intelligently obtained... I would be some kind of genius or incredible pessimist to start shorting Twitter during their huge upturn. It's only by dumb luck that this algo wins in the end. In fact, at one point I even had the order_possible function in the sell logic, instead of the buy logic as I intended.