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!

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57d46fc25f273f102efb086b
There was a runtime error.