Login Page - Create Account

Support Board


Date/Time: Sun, 12 Jan 2025 18:43:09 +0000



Post From: NewPeriodAtBothSessionStarts parameter

[2017-03-04 13:44:49]
DabbaDo - Posts: 148
The documentation at http://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scGetStartOfPeriodForDateTime doesn't cover this parameter. But I think it means to report a new StartOfPeriod when passing each session boundary when using two sessions.
But I'm confused by your code in Studies8.cpp L5911 (scsf_CumulativeDeltaBarsVolume):

if (Index == 0)
  Reset = true;
else if (ResetAtBothSessionStarts.GetYesNo() != 0 )
{
  SCDateTime PriorStartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index - 1], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0,1);
  SCDateTime StartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0,1);
  if (StartOfPeriod != PriorStartOfPeriod)
  {
    Reset = true;
  }
}
else if (ResetAtSessionStart.GetYesNo() != 0 )
{
  SCDateTime PriorStartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index - 1], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0, 0);
  SCDateTime StartOfPeriod = sc.GetStartOfPeriodForDateTime(sc.BaseDateTimeIn[Index], TIME_PERIOD_LENGTH_UNIT_DAYS ,1,0,0);
  if (StartOfPeriod != PriorStartOfPeriod)
  {
    Reset = true;
  }
}
Note that the condition for both of the "else if" statements is the same, and only the NewPeriodAtBothSessionStarts parameter is different. I don't understand the intent of this logic, so I'm concerned I may not understand how NewPeriodAtBothSessionStarts works.

Cheers,
Dale