Login Page - Create Account

Support Board


Date/Time: Wed, 30 Apr 2025 10:57:36 +0000



Persistent SCDateTime reset on last bar

View Count: 26

[2025-04-29 04:29:23]
User200641 - Posts: 8
I have a manual looping study that plots levels from the overnight and rth session. During some debug, I found the persistent SCDateTime object used to define my rth start time was being reset to 1899/12/30 00:00:00 on the last bar before resolving itself. It only does this on the last bar and values calculated throughout the study are correct.

I created another persistent SCDateTime to store current_trading_date_rth_start for the next run to see if the SCDateTime object was being updated somewhere in the code. This storage persistent SCDateTime also exhibited the same behavior, being set to 1899/12/30 00:00:00.

Is this intended/known behavior and if so how can I avoid my SCDateTime objects from being zeroed out on the last bar?

Thanks
[2025-04-29 11:51:27]
User200641 - Posts: 8
After sleeping on this, I realized my SCDateTime persistents were not being initialized using the "address-of" operator ('&'). Properly initializing them fixes the "resetting to epoch time" issue I was having.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account