Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Simple Moving Average 4

Moving average condition met and only if when we don't a position then buy.
Moving average condition met and only if only if when we have a position then sell.
buy method: spend 100% of our capital
sell method: sell all our stocks

2 responses

@Cody,

I deleted 80% lines from your code and the results are the same.
I am wondering what these 80% lines should do?

They were something that I wanted to add to make the first transaction in certain condition. If context.firstTrade equals True right in the beginning, then you are right, it would be no different.