Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
MA crossover help!

Hello all!

I am trying to create an somewhat easy MA crossover strategy 8sma and 20sma on 5 minute time frame. when I run it it comes back "okay" but there are times when it randomly buys 100 shares at 10:29 and sells it at 10:30 and the buy is not at the crossover, sometimes it is 2- minutes early or 5 minutes after the cross. The strategy does not say to do that (in my knowledge).

I am novice in Q.

Also, how can I put it in to check my portfolio if I have any opened positions?

Thank you.