I would like to schedule my algorithm to run every hour after market open. The code below runs every hour. How can I incorporate a check to see if the market is open, and then run it every hour? I am backtesting the code by backdating the dates, so I would like the code to work with backtesting. Any example would be greatly appreciated.



self.Schedule.On(self.DateRules.EveryDay(), \

self.TimeRules.Every(TimeSpan.FromHours(1)), \

self.GenerateBuySignal)