I'm trying to get the day and hour of when high or low has occurred using Rolling window.
+ Expand
class RetrospectiveAsparagusMule(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 12, 31)
self.SetEndDate(2020,6,1)
self.SetCash(1000)
for symbol in self.curr:
self.eurusd = self.AddForex(symbol, Resolution.Hour).Symbol
self.SetBenchmark(symbol)
self.Consolidate(self.eurusd, timedelta(hours=4), self.HourQuoteBarHandler)
self.window = RollingWindow[QuoteBar](60)
#self.SetWarmUp(60)
def OnData(self, data):
if not (self.window.IsReady):
return
for symbol in self.curr:
price = data[symbol].Close
time = {}
for i in range(60):
self.high_values.append(self.window[i].High)
self.low_values.append(self.window[i].Low)
time[self.window[i].High] = self.Time
time[self.window[i].Low] = self.Time
In this case self.Time will return only the actual time of the backtest and not the value I'm looking for which is the time at which the high and low have occurred on the chart.
Is this something that can only be achieved through history request?
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!