Overall Statistics
Total Trades
140
Average Win
2.97%
Average Loss
-4.11%
Compounding Annual Return
24.929%
Drawdown
34.200%
Expectancy
0.339
Net Profit
210.105%
Sharpe Ratio
0.826
Probabilistic Sharpe Ratio
25.355%
Loss Rate
22%
Win Rate
78%
Profit-Loss Ratio
0.72
Alpha
0.073
Beta
1.071
Annual Standard Deviation
0.243
Annual Variance
0.059
Information Ratio
0.473
Tracking Error
0.173
Treynor Ratio
0.188
Total Fees
$145.38
Estimated Strategy Capacity
$190000000.00
Lowest Capacity Asset
GOOG T1AZ164W5VTX
# Top Dollar Volume and OHL Momentum Universe


class DeltaMomentum(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2017, 3, 3)  
        self.SetEndDate(2022, 4, 1)  
        self.SetCash(100000)  
        self.UniverseSettings.Resolution = Resolution.Daily
        self.AddUniverse(self.CoarseSelection)
        self.selectedSymbols = []
        self.universeMonth = -1


    def CoarseSelection(self, coarse):
        if self.Time.month == self.universeMonth:
            return self.selectedSymbols

        selected = [x for x in coarse if (x.HasFundamentalData) and (float(x.Price) > 5)]
        dollar_volume_sorted = sorted(selected, key=lambda x: x.DollarVolume, reverse = True)
        topDollarVolume = dollar_volume_sorted[:10]
        topDollarVolumeSymbols = [x.Symbol for x in topDollarVolume]
        
        hist = self.History(topDollarVolumeSymbols, 22, Resolution.Daily)
        O = hist['open'].unstack(level = 0)
        H = hist['high'].unstack(level = 0)
        L = hist['low'].unstack(level = 0)
        
        momentum = O.ix[-2] * H.ix[-2] * L.ix[-2] / O.ix[0] * H.ix[0] * L.ix[0] 
        top_momentum = momentum.sort_values(ascending = False)[:2]
        self.selectedSymbols = [self.Symbol(str(x)) for x in top_momentum.index]
        self.Debug([self.Symbol(str(x)).Value for x in top_momentum.index])
        
        return self.selectedSymbols
        
        
    def OnData(self, data):
        if self.Time.month == self.universeMonth: return
        
        for sec in self.Portfolio.Keys:
            if sec not in self.selectedSymbols:
                self.Liquidate(sec)
                    
        for sec in self.selectedSymbols:
            self.SetHoldings(sec, 1/len(self.selectedSymbols))
            
        self.universeMonth = self.Time.month