QC Team and Community

from QuantConnect.Data.Market import TradeBar
from datetime import datetime
from datetime import timedelta
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
import decimal as d
import pandas as pd

class BollingerBreakoutAlgorithm(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2015, 1, 1)
self.SetEndDate(2019, 12, 10)
self.SetCash(10000)
self.MOMP = dict()

for ticker in ["XLK", "XLF", "XLI", "XLY", "XLB", "XLP", "XLV", "XLU", "XLE"]:
symbol = self.AddEquity(ticker, Resolution.Daily).Symbol
self.MOMP[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 OnData(self, data):
if not all([self.MOMP.IsReady for symbol, MOMP in self.MOMP.items()]):
return

df = self.History(MOMP[symbol], 5, Resolution.Daily)
self.log("df")

,

My strategy here (may not be the best) but is to set holdings on the highest momentum scoring symbol in the list on a weekly basis and dropping the previous if it is different or does not exist.  I assume I need a dataframe including each symbol and its indicator value to find the highest scorer.  How do I set up the dataframe and get the highest scoring symbol.  Any help would be appreciated.

Thanks