Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help! I'm trying to adjust my leverage by using SMA

Hello...I am very new to Python and Quantopian and I was wondering if you could let me know where I am going wrong here.

Basically I want to use the crossover SMA of SPY to define what leverage I should be using...now I'm not great at coding so Im not sure where I have gone wrong here?!? Please see my attached code.

Any help would be greatly appreciated. Thanks!