Overall Statistics |
Total Trades 85 Average Win 1.55% Average Loss -1.03% Compounding Annual Return 9.315% Drawdown 11.200% Expectancy 0.192 Net Profit 8.756% Sharpe Ratio 0.677 Probabilistic Sharpe Ratio 37.691% Loss Rate 52% Win Rate 48% Profit-Loss Ratio 1.50 Alpha -0.095 Beta 0.744 Annual Standard Deviation 0.147 Annual Variance 0.021 Information Ratio -1.386 Tracking Error 0.117 Treynor Ratio 0.133 Total Fees $91.35 |
import operator class MOMPAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 1, 1) self.SetEndDate(2019, 12, 10) self.SetCash(10000) self.mom = {} for ticker in ["XLK", "XLF", "XLI", "XLY", "XLB", "XLP", "XLV", "XLU", "XLE"]: symbol = self.AddEquity(ticker, Resolution.Daily).Symbol self.mom[symbol] = self.MOMP(symbol, 5, Resolution.Daily) self.SetWarmUp(26, Resolution.Daily) self.SetBenchmark("SPY") self.Schedule.On(self.DateRules.Every(DayOfWeek.Wednesday), self.TimeRules.At(12, 0), self.EveryWedAtNoon) def EveryWedAtNoon(self): #check if indicators are ready to go if not all([MOMP.IsReady for symbol, MOMP in self.mom.items()]): return #find key with highest MOMP value highestKey = sorted(self.mom, key = lambda k: self.mom[k].Current.Value, reverse = True)[0] #restructure portfolio according to changes in MOMP if self.Portfolio.Invested and not self.Portfolio[highestKey].Invested: self.Liquidate() self.SetHoldings(highestKey, 1)