Overall Statistics
Total Trades
75
Average Win
20.00%
Average Loss
-2.04%
Compounding Annual Return
9.454%
Drawdown
35.600%
Expectancy
2.439
Net Profit
731.383%
Sharpe Ratio
0.715
Probabilistic Sharpe Ratio
6.293%
Loss Rate
68%
Win Rate
32%
Profit-Loss Ratio
9.81
Alpha
0.086
Beta
0.203
Annual Standard Deviation
0.15
Annual Variance
0.023
Information Ratio
0.012
Tracking Error
0.212
Treynor Ratio
0.529
Total Fees
$134.92
Estimated Strategy Capacity
$53000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
class CalmBrownTermite(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(1998, 1, 2)
        self.SetCash(10000) 
        self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol
        self.Fast = self.SMA(self.spy,50,Resolution.Daily)
        self.Slow = self.SMA(self.spy,200,Resolution.Daily)
        
        
        self.previous = self.Time.min
        self.Tolerance = 0.00015
    def OnData(self, data):
        
        if not self.Slow.IsReady :return
        if  self.previous is  None or self.previous.day==self.Time.day:return
        holdings = self.Portfolio[self.spy].Quantity
        if holdings<=0:
            if self.Fast.Current.Value>self.Slow.Current.Value*(1+self.Tolerance):
                self.SetHoldings(self.spy,1)
                self.Debug("BUY  >> " + str(self.Securities[self.spy].Price))
        else:
            
            if self.Fast<self.Slow:
                self.SetHoldings(self.spy,-1)
        if self.Portfolio[self.spy].UnrealizedProfit<= -420:
                self.Debug("Sell at "+str(self.Securities[self.spy].Price))
                self.Liquidate()
        self.previous = self.Time