Overall Statistics
Total Trades
89
Average Win
2.25%
Average Loss
-1.54%
Compounding Annual Return
10.071%
Drawdown
12.800%
Expectancy
0.232
Net Profit
24.678%
Sharpe Ratio
0.803
Probabilistic Sharpe Ratio
35.710%
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
1.46
Alpha
0.092
Beta
-0.054
Annual Standard Deviation
0.11
Annual Variance
0.012
Information Ratio
0.134
Tracking Error
0.255
Treynor Ratio
-1.633
Total Fees
$89.00
class NadionHorizontalCircuit(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 1, 2)  # Set Start Date
        self.SetCash(10000)  # Set Strategy Cash
        # self.AddEquity("SPY", Resolution.Minute)
        self.spy = self.AddEquity("SPY", Resolution.Daily)
        self.spy.SetDataNormalizationMode(DataNormalizationMode.Raw)
    
        self.roc = self.ROC("SPY", 5, Resolution.Daily)
        self.SetWarmUp(timedelta(days = 5))
        
        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", 5), self.Rebalance)
        
    def Rebalance(self):
        
        if self.IsWarmingUp:
            return
        
        if self.roc.Current.Value > 0:
            self.SetHoldings("SPY",1)
        else:
            self.Liquidate("SPY")
class Volatility(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 1, 2)  # Set Start Date
        self.SetCash(10000)  # Set Strategy Cash
        # self.AddEquity("SPY", Resolution.Minute)
        self.ziv = self.AddEquity("ZIV", Resolution.Daily)
        self.ziv.SetDataNormalizationMode(DataNormalizationMode.Raw)
    
        self.roc = self.ROC("ZIV", 5, Resolution.Daily)
        self.SetWarmUp(5)
        
        
    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
        if self.IsWarmingUp:
            return
        
        if self.roc.Current.Value > 0:
            self.SetHoldings("ZIV",1)
        else:
            self.Liquidate("ZIV")