Overall Statistics
Total Trades
932
Average Win
8.36%
Average Loss
-1.17%
Compounding Annual Return
42.291%
Drawdown
36.300%
Expectancy
0.769
Net Profit
2779.449%
Sharpe Ratio
1.185
Probabilistic Sharpe Ratio
48.263%
Loss Rate
78%
Win Rate
22%
Profit-Loss Ratio
7.11
Alpha
0.26
Beta
1.181
Annual Standard Deviation
0.362
Annual Variance
0.131
Information Ratio
0.899
Tracking Error
0.318
Treynor Ratio
0.363
Total Fees
$139530.49
Estimated Strategy Capacity
$740000.00
Lowest Capacity Asset
SVXY V0H08FY38ZFP
class SleepyFluorescentYellowCat(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2012, 1, 1)
        self.SetCash(100000) 
        self.AddEquity('SVXY',Resolution.Minute)
        res=Resolution.Daily
        self.uvxy=self.AddEquity('UVXY',res).Symbol
        self.bb=self.BB(self.uvxy,10,2,res)
        self.sma=self.SMA(self.uvxy,4,res)
        self.rc=self.RC(self.uvxy,6,0.3,res)
        self.trigger=False
        self.buy=False
        self.hold=False
        self.sell=False

    def OnData(self, data):

        if self.bb.IsReady and data.ContainsKey(self.uvxy) and self.sma.IsReady:
            vix=data[self.uvxy].Close
            if self.rc.UpperChannel.Current.Value<vix:
                self.trigger=True

            if self.trigger and self.sma.Current.Value>vix:
                self.buy=True

            if self.hold and (vix<(self.bb.MiddleBand.Current.Value-self.bb.StandardDeviation.Current.Value)):
                self.sell=True
                
            
        if self.buy and data.ContainsKey('SVXY'):
            self.SetHoldings('SVXY',1)
            self.trigger=False
            self.buy=False
            self.hold=True

        if data.ContainsKey('SVXY') and (self.sell or self.Portfolio['SVXY'].UnrealizedProfitPercent<-0.04):
            self.SetHoldings('SVXY',0)
            self.hold=False
            self.sell=False