Hello All, 

 I am a little confused how to ensure I am scheduling events at the times that I think I am scheduling them for. 

I have checked the Exchange.TimeZone property of my returned CFD. This part seems nice enough. However, when I cross check the data that I am receiving with other sources of the same feed, I cannot seem to make a connection between the time I think I am sceduling an event for and the data I am receiving. 

To validate my setup, I am just check the most recent data when event is triggered and comparing it to Oanda's feed on Tradingview at the same time. However, I can't seem to find matching data. 

It might be an issue with the way I am saving the last close value in OnData(). The following is my code and some screenshots of my debugs and data on Tradingview. 

import numpy as np from System import * ### <summary> ### Basic template algorithm simply initializes the date range and cash. This is a skeleton ### framework you can use for designing an algorithm. ### </summary> class FTSEFridays(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2018,7, 1) #Set Start Date self.SetEndDate(2018,7,11) #Set End Date self.SetCash(10000) #Set Strategy Cash self.Allocate = 1 # Percentage of holdings to risk # Setup Oanda Broker simulation self.SetBrokerageModel(BrokerageName.OandaBrokerage) # Find more symbols here: http://quantconnect.com/data # THIS NEEDS TO BE ADDED AFTER THE BROKERAGE MODEL! self._ftse = self.AddCfd("UK100GBP", Resolution.Minute) #Logging / Debugs self.Logging_On = True self.Debug_On = True # Other stuff self.lastClose = None #Set Shcedule # self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday,DayOfWeek.Friday), self.TimeRules.At(6, 55), self.MorningBuy) # self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday,DayOfWeek.Friday), self.TimeRules.At(16, 29), self.AfternoonSell) self.Schedule.On(self.DateRules.WeekEnd(), self.TimeRules.At(6, 55), self.MorningBuy) self.Schedule.On(self.DateRules.WeekEnd(), self.TimeRules.At(16, 29), self.AfternoonSell) if self.Debug_On: self.Debug("INIT: Exchange Hours: {}".format(self._ftse.Exchange.Hours)) self.Debug("INIT: Exchange Timezone: {}".format(self._ftse.Exchange.TimeZone)) self.Debug("INIT: Local Time: {}".format(self._ftse.Exchange.LocalTime)) self.Debug("INIT: Self.Time {}".format(self.Time)) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' self.lastClose = data["UK100GBP"].Close def MorningBuy(self): if self.Debug_On: self.Debug("MorningBuy: Fired at : {0}, Local Time: {1}, Close Price: {2}".format( self.Time, self._ftse.Exchange.LocalTime, self.lastClose)) self.SetHoldings("UK100GBP", self.Allocate) def AfternoonSell(self): if self.Debug_On: self.Debug("AfternoonSell: Fired at : {0}, Local Time: {1}, Close Price: {2}".format( self.Time, self._ftse.Exchange.LocalTime, self.lastClose)) self.Liquidate

Here is my output

https://i.imgur.com/Wgf6hBk.png

It shows that the close was 7611.4 at 06:55am (self.Time) and 11:55am Local Exchange Time) 

Then if I look at the data for both self.Time and Exchange.LocalTime on Tradingview (06:55am and 11:55am respectively), I don't see any close matching it or within a bar. 

First 6:55 am - Close = 7632.6

https://i.imgur.com/VnVZHOy.png

Second 11:55am - Close = 7570.3

https://i.imgur.com/aKS2vYk.png

I assume that this might be something at my end. Any pointers would be greatly appreciated. 

PS. Where does self.Time come from? is it NYC?