Overall Statistics
Total Trades
185
Average Win
4.00%
Average Loss
-0.90%
Compounding Annual Return
8.932%
Drawdown
16.900%
Expectancy
1.248
Net Profit
210.300%
Sharpe Ratio
0.765
Probabilistic Sharpe Ratio
15.032%
Loss Rate
59%
Win Rate
41%
Profit-Loss Ratio
4.45
Alpha
0.08
Beta
-0.012
Annual Standard Deviation
0.103
Annual Variance
0.011
Information Ratio
-0.097
Tracking Error
0.215
Treynor Ratio
-6.388
Total Fees
$779.08
Estimated Strategy Capacity
$1200000000.00
# SMA as support

class SMA_support(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2008, 1, 1)  
        self.SetCash(100000)  
        ma = 100
        self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.support = self.SMA(self.symbol, ma, Resolution.Daily) 
        self.SetWarmUp(ma + 1)
        
    def OnData(self, data):
        price = self.Securities[self.symbol].Price
        support = self.support.Current.Value
        self.Plot('SMA', 'price', price)
        self.Plot('SMA', 'support', support)

        if price > support:
            self.SetHoldings(self.symbol, 1)
        else:
             self.SetHoldings(self.symbol, 0)