Hi team, 

I am new to the platform and struggling to understand it. I've searched extensively through examples and previous discussions to no avail. 

I do not understand how time zones work - both how to set them and what I should expect to get back. I need this to validate that I am consolidating data correctly for indicators.

I have attached some simple code where I have used the SetTimeZone function to set it to Chicago time. I have done this in the Initialize() method. (There are no orders placed in my sample.)

Then, in the OnData() function, I have created an if statement → if tradebar.Time.Hour == 21 then Log the tradebar.Time, and OHLC of the bar. I was trying to get the values for 9:00-9:59PM Chicago Time. The resulting log shows rows like: 

2021-09-16 16:01:00 :9/16/2021 9:00:00 PM Open:3498.13 High:3503.71 Low:3490.83 Close:3503.71

Notice that the timestamp hours do not align. tradebar.Time actually returned UTC time so I got the values for 4:00-4:59PM Chicago Time.

Why is this happening when I set the TimeZone earlier? Will tradebar.Time.Hour always be in UTC, so the values should always be adjusted? 

Thanks for your help in advance!

-D