Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:47:48 +0000



Behaviour of sc.GetStartOfPeriodForDateTime

View Count: 238

[2023-08-28 12:08:22]
User907968 - Posts: 823
I don't know if something changed, but the behaviour of sc.GetStartOfPeriodForDateTime does not seem to be consistent with the documentation when using TIME_PERIOD_LENGTH_UNIT_WEEKS.

Documentation says:
For periods based on weeks, the start will be either Sunday or Monday depending upon the setting of Global Settings >> General Settings >> General >> Data >> Use Monday as Start of Week instead of Sunday.
and yet, it seems to return the date time for Saturday.

if I include the code below and step through in the debugger, I can see that the AddDays part is executed, which it shouldn't be if the week start is Sunday.


auto sDT = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[sc.ArraySize - 1], TIME_PERIOD_LENGTH_UNIT_WEEKS, 1, 0);

if (sDT.IsSaturday())
sDT.AddDays(1);

Maybe it is a misunderstanding on my part?
[2023-08-28 16:30:27]
Sierra_Chart Engineering - Posts: 17191
This is going to be affected by the Session Times if the session times are reversed. Refer to:
Chart Session Times: Starting Trading Day in Prior Day
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account