Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
50/200MA Crossover Strategy SPY, no short component

Simple 50/200MA Crossover Strategy for $SPY, no short component

3 responses

Thank you for this code, helpful in getting started with this API. A question for Quantopian, when are moving averages available for trading decisions versus the start dates for the backtest? It appears that the benchmark starts right away (at the start date) but the moving average for the stock to be compared is computed after X periods from the start date so there is a delay when a trade can be made (e.g. 50 days for a 50 day MA). Therefore, the benchmark has a running start, 50 days of trading activity, before the comparison, giving it a positive advantage if trading up or will lag behind if trading down. Is this accurate and, if so, can this be corrected?

Claus, you may want to take a look at the posts in the moving average versus benchmark posts. There is a good response there about how time can affect the results of the call to the moving averages.

Cool, will do, thanks Steve.