Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trend following ETF algorithm.

This is a trend following ETF strategy.

1 response

@Pratik

If you check the positions in your algo (Backtester --> Activity --> Positions --> Load Positions)
You won't find any short positions.

In my backtest of your algo I just change the start date to 10/01/2008 and didn't find any long positions.

Check this two lines

    if sma7 > sma21 and not context.shorting:

    elif sma7 < sma21 and not context.go_long:  

To my mind they should be like this

    if sma7 > sma21 and not context.go_long:

    elif sma7 < sma21 and not context.shorting: