Hello,
I am trying to build a momentum strategy. Basically what it is supposed to do is:
If SPY's 50 day SMA is below or equal to the 200 day SMA, then it shall buy IEF.
If that's not the case, it should choose the top 6 ETF's ranked by a 20 day Momentum and buy them, if the 50 day SMA is higher than the 200 day SMA.
I am supposed to use the chosen template for all my algorithms so I get used to using it.
I scrambled a few things together and got the attached algorithm. It now gives me the Error:
"ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). There was a runtime error on line 208."
In the initialize function are all ETF's, that are used in the book's strategy.
I am pretty new to Python and Quantopian and would appreciate all help given. Thanks !