Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
I can't tell what's going wrong with my SMA algo on $SPY

I just started coding my first algo. I am basing my strategy on SMA crossover events.

The test shows only a few transactions, and only a few of them go the way I would have hoped. When it does make an order, it sometimes makes the exact opposite order (it will buy when it should have shorted, or short when it should have bought).

Any help would be greatly appreciated.

thanks.