Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -1.724 Tracking Error 0.148 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 |
# MOMP Comparison 3 # --------------------------------- STOCK = 'QQQ'; RETURN_PERIOD = 126; # --------------------------------- class EnergeticOrangeBat(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) self.SetEndDate(2021, 3, 1) self.SetCash(100000) self.stock = self.AddEquity(STOCK, Resolution.Daily).Symbol # self.EnableAutomaticIndicatorWarmUp = True self.SetWarmUp(RETURN_PERIOD + 1) self.mom = self.MOMP(self.stock, RETURN_PERIOD, Resolution.Daily) # Warm up history = self.History(self.stock, RETURN_PERIOD + 1, Resolution.Daily) for time, row in history.loc[self.stock].iterrows(): self.mom .Update(time, row.close) self.Log(f"Starting values: {self.mom.Current.Value}") def returns(self, symbol, period): prices = self.History(symbol, period + 1, Resolution.Daily).close return float(100*(prices.iloc[-1] / prices.iloc[0] - 1)) def OnData(self, data): if not (data.ContainsKey(self.stock) and data[self.stock] is not None): return if self.IsWarmingUp or not self.mom.IsReady: return self.mom_2 = self.returns(self.stock, RETURN_PERIOD) self.Plot("Momentum Percent", "MOMP", self.mom.Current.Value) self.Plot("Momentum Percent", "RET", self.mom_2) self.Log(f"Ending values: {self.mom.Current.Value} {self.mom_2}")