| 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.055 Tracking Error 0.273 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# Weighted Momentum Indicator
# -------------------------------------------------------------------------------------
UNIVERSE = ["QQQ","SPYG","SPYV","IJK","IJS","XLF","XHB","XRT","SMH","PPH"]; MOM = 21;
# -------------------------------------------------------------------------------------
class WeightedMomentumIndicator(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
self.SetEndDate(2021, 8, 23)
self.mom_weighted = {}
self.mom_1 = {}
self.mom_2 = {}
self.mom_3 = {}
self.SetWarmUp(3*MOM + 1, Resolution.Daily)
self.universe = [self.AddEquity(ticker, Resolution.Minute).Symbol for ticker in UNIVERSE]
for sec in self.universe:
self.mom_1[sec] = self.ROCP(sec, MOM, Resolution.Daily)
self.mom_2[sec] = IndicatorExtensions.Of(Delay(MOM), self.mom_1[sec])
self.mom_3[sec] = IndicatorExtensions.Of(Delay(2*MOM), self.mom_1[sec])
self.Schedule.On(self.DateRules.MonthStart(self.universe[0]), self.TimeRules.AfterMarketOpen(self.universe[0], 10),
self.Indicator)
def Indicator(self):
if self.IsWarmingUp: return
for sec in self.universe:
if not (self.mom_1[sec].IsReady and self.mom_2[sec].IsReady and self.mom_3[sec].IsReady): continue
self.mom_weighted[sec] = (3*self.mom_1[sec].Current.Value + 2*self.mom_2[sec].Current.Value + self.mom_3[sec].Current.Value) / 6
self.Plot('Weighted Momentum', sec, self.mom_weighted[sec])