Overall Statistics
Total Trades
115
Average Win
0.31%
Average Loss
-0.73%
Compounding Annual Return
-25.619%
Drawdown
26.600%
Expectancy
-0.518
Net Profit
-25.619%
Sharpe Ratio
-1.66
Probabilistic Sharpe Ratio
0.108%
Loss Rate
66%
Win Rate
34%
Profit-Loss Ratio
0.43
Alpha
-0.211
Beta
0.028
Annual Standard Deviation
0.127
Annual Variance
0.016
Information Ratio
-1.24
Tracking Error
0.186
Treynor Ratio
-7.554
Total Fees
$253.19
Estimated Strategy Capacity
$430000000.00
# based on what's shown, i didnt backtest this

class EnergeticOrangeBuffalo(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2015, 1, 1)  # Set Start Date
        self.SetEndDate(2016, 1, 1)  # Set End Date
        self.SetCash(100000)  # Set Strategy Cash
        self.spy = self.AddEquity("SPY", Resolution.Daily)
        self.sma = self.SMA("SPY", 30, Resolution.Daily)



    def OnData(self, data):
        if not self.sma.IsReady:
            return  
        Close = data["SPY"].Close
        SMA = self.sma.Current.Value
        self.Debug("SPY Closing Price: " + str(Close) + ", 30 period SMA Value: " + str(SMA))

        # if self.securities["SPY"].Price>self.sma.Current.Value:
        # you could capitalize the S, i think that was the error
        if Close > SMA:
            self.SetHoldings("SPY", 1)
        else:
            self.SetHoldings("SPY", -1)