Overall Statistics |
Total Trades 10 Average Win 7.38% Average Loss -1.36% Compounding Annual Return 130.133% Drawdown 2.500% Expectancy 2.865 Net Profit 19.224% Sharpe Ratio 3.406 Probabilistic Sharpe Ratio 89.323% Loss Rate 40% Win Rate 60% Profit-Loss Ratio 5.44 Alpha 0.938 Beta 0.566 Annual Standard Deviation 0.321 Annual Variance 0.103 Information Ratio 2.563 Tracking Error 0.319 Treynor Ratio 1.93 Total Fees $237.09 Estimated Strategy Capacity $360000000.00 Lowest Capacity Asset AHPI R735QTJ8XC9X |
# Trading Volume Oscillator # ---------------------------------------------------------- STOCKS = ["SPY", "AHPI"]; FAST = 1; SLOW = 20; THRESOLD = 2; # ---------------------------------------------------------- class HipsterOrangeMonkey(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 6, 1) self.SetEndDate(2021, 8, 15) self.SetCash(100000) self.stocks = [self.AddEquity(ticker, Resolution.Daily).Symbol for ticker in STOCKS] self.macd = MovingAverageConvergenceDivergence(FAST, SLOW, MovingAverageType.Simple) self.vo ={} self.SetWarmUp(SLOW, Resolution.Daily) def OnData(self, data): if self.IsWarmingUp: return for sec in self.stocks: if data.Bars.ContainsKey(sec): self.macd.Update(data[sec].EndTime, data[sec].Volume) if self.macd.IsReady: self.vo[sec] = self.macd.Fast.Current.Value / self.macd.Slow.Current.Value self.Plot('Volume Oscillator', sec, self.vo[sec]) self.Plot('Volume Oscillator', "THRESOLD", THRESOLD) selected = [] for sec in self.vo: if self.vo[sec] > THRESOLD: selected.append(sec) if len(selected) == 0: self.Liquidate() else: for sec in selected: self.SetHoldings(sec, 1/len(selected))