Login Page - Create Account

Support Board


Date/Time: Mon, 13 May 2024 11:18:01 +0000



High / Low for the time period = extended: wrong start on the tick chart

View Count: 791

[2020-10-08 07:52:18]
User112177 - Posts: 8
Hello Support,

Just found that your built-in study [High Low for the time period - extended] has wrong start time ob version 2177 when using TICK CHARTS
V2150 on my spare [backup] laptop looks OK
Could you fix it, please?
Note - chart book with the single chart - according to your instructions + screenshot [to see where to look - just to save you some time] attached.

Thanks in advance.
imageSC=HiLo_4_timePer_ext=wrong_start_on_the_TICK_chart.png / V - Attached On 2020-10-08 07:47:59 UTC - Size: 117.42 KB - 248 views
attachmentHiLo_4_time_period_ext=wring_at0930.Cht - Attached On 2020-10-08 07:49:41 UTC - Size: 9.14 KB - 242 views
[2020-10-08 09:24:42]
Sierra Chart Engineering - Posts: 104368
We definitively do not see any problem here and we have absolutely no idea what you are trying to show in that chart image. We checked the Chartbook, and both of the studies on the charts, checked independently, work 100% correctly.

There definitely is not a problem. If there is a change in behavior, it is because there was a correction of prior issues that can occur under certain conditions.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-10-08 09:27:33
[2020-10-08 10:09:51]
User112177 - Posts: 8
... definitely is not a problem ...

Start time for the day session should be 09:30, not 09:26.
I've just attached picture from v 2150 showing correct graph [starts at 09:30]
imageHiLo_v2150=correctStartTime=0930=NOT_0926_on_v_2177.png / V - Attached On 2020-10-08 10:09:31 UTC - Size: 76.3 KB - 215 views
[2020-10-08 10:32:13]
User791968 - Posts: 3
I am having the same problem. I just updated to 2177, wasn't having a problem before 2177. The high low lines are not resetting at the beginning of each new session, they are just continuing on with the previous sessions highs and lows. I've triple checked my settings.
[2020-10-08 11:22:25]
User90125 - Posts: 715
Just curious. Could either of you post pictures of your Session Times settings from the Chart Settings box?
[2020-10-08 12:55:51]
User112177 - Posts: 8
Hello User212764,
Session Times settings from the Chart Settings box?
Yep, just did, thanks for helping us out : )).
Old session ENDiNG time was 09:29:29, typo obvously - that's why I couldn't figure why "High-Low" for the day started at 09:26

When I've changed it to 09:30:00 or 09:29:59 - start time "Hi-Low Daily" bar "moved" from 09:26:51 to 09:29:48 [was 09:30:00 exactly on v 2150]

NOTE: 1-minute & 5-minute charts do NOT have this problem; daily graph starts at 09:30 [as expected] - doesn't matter 09:29:29 or 09:29:59 or 09:30:00
Attachment Deleted.
imagesc_settings_Session_times_OLD=092929.png / V - Attached On 2020-10-08 12:55:16 UTC - Size: 155.18 KB - 205 views
imagesc_settings_Session_times=092959.png / V - Attached On 2020-10-08 12:55:24 UTC - Size: 159.73 KB - 208 views
[2020-10-08 15:37:22]
User300921 - Posts: 7
PS just checked setting & everything else [reloaded data etc]: today DAY session "started" at 09:27:38
imageSessTime=Doesnt_matter=Same_today=starts_at_092738.png / V - Attached On 2020-10-08 15:37:13 UTC - Size: 119.68 KB - 212 views
[2020-10-08 16:08:21]
User791968 - Posts: 3
I installed the previous version(2168) and it started working correctly again. Its a range chart, day session only.
Date Time Of Last Edit: 2020-10-08 16:08:57
[2020-10-08 16:13:08]
User90125 - Posts: 715
@User791968

Could you paste the code for that previous version from v2168 into a post so that we can compare and contrast the code?

Thanks.
[2020-10-08 16:31:20]
User791968 - Posts: 3
Sorry, not sure how to do that. I just went to Help>>Install Previous Version, it sent me back to 2168.
[2020-10-08 18:09:06]
Ackin - Posts: 1865
User212764)
Could you paste the code for that previous version from v2168 into a post so that we can compare and contrast the code?



//xx68

SCSFExport scsf_HighLowForTimePeriodExtendedLines(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_HighOfDay = sc.Subgraph[0];
  SCSubgraphRef Subgraph_LowOfDay = sc.Subgraph[1];

  SCInputRef Input_StartTime = sc.Input[0];
  SCInputRef Input_EndTime = sc.Input[1];
  SCInputRef Input_NumberDaysToCalculate = sc.Input[2];
  SCInputRef Input_Version = sc.Input[4];
  SCInputRef Input_LineStopTimeInput = sc.Input[5];
  SCInputRef Input_DisplayHighLowIncrementally = sc.Input[6];

  SCInputRef Input_InputDataHigh = sc.Input[7];
  SCInputRef Input_InputDataLow = sc.Input[8];
  SCInputRef Input_FridayEveningExtendsIntoSunday = sc.Input[9];

  if (sc.SetDefaults)
  {
    sc.GraphName      = "High/Low for Time Period - Extended";
    sc.GraphRegion      = 0;
    sc.AutoLoop        = 0;
    
    Subgraph_HighOfDay.Name = "High";
    Subgraph_HighOfDay.DrawStyle = DRAWSTYLE_STAIR_STEP;
    Subgraph_HighOfDay.PrimaryColor = RGB(0,255,0);
    Subgraph_HighOfDay. DrawZeros = false;
    
    Subgraph_LowOfDay.Name = "Low";
    Subgraph_LowOfDay.DrawStyle = DRAWSTYLE_STAIR_STEP;
    Subgraph_LowOfDay.PrimaryColor = RGB(255,0,255);
    Subgraph_LowOfDay.DrawZeros = false;

    Input_StartTime.Name = "Start Time";
    Input_StartTime.SetTime(0);

    Input_EndTime.Name = "End Time";
    Input_EndTime.SetTime(SECONDS_PER_DAY - 1);
  
    Input_NumberDaysToCalculate.Name= "Number Of Days To Calculate";
    Input_NumberDaysToCalculate.SetInt(120);

    Input_LineStopTimeInput.Name = "Line Stop Time";
    Input_LineStopTimeInput.SetTime(SECONDS_PER_DAY - 1);

    Input_DisplayHighLowIncrementally.Name = "Display High Low Incrementally";
    Input_DisplayHighLowIncrementally.SetYesNo( true);

    Input_InputDataHigh.Name = "Input Data High";
    Input_InputDataHigh.SetInputDataIndex(SC_HIGH);

    Input_InputDataLow.Name = "Input Data Low";
    Input_InputDataLow.SetInputDataIndex(SC_LOW);

    Input_FridayEveningExtendsIntoSunday.Name = "Friday Evening Extends Into Sunday";
    Input_FridayEveningExtendsIntoSunday.SetYesNo(false);

    Input_Version.SetInt(3);

    return;
  }

  if (Input_Version.GetInt() == 1)
  {
    Input_InputDataHigh.SetInputDataIndex(SC_HIGH);
    Input_InputDataLow.SetInputDataIndex(SC_LOW);

    Input_Version.SetInt(2);
  }

  if (Input_Version.GetInt() <= 2)
  {
    Input_LineStopTimeInput.SetTime(sc.EndTime1);
    Input_Version.SetInt(3);
  }

  if (Input_NumberDaysToCalculate.GetInt() <= 0)
    Input_NumberDaysToCalculate.SetInt(10000);
  
  float & HighOfPeriod = sc.GetPersistentFloatFast(1);
  float & LowOfPeriod = sc.GetPersistentFloatFast(2);

  SCDateTime DaysToCalculateStartDateTime = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[sc.ArraySize - 1]) - (Input_NumberDaysToCalculate.GetInt() - 1);

  // Loop through chart bars starting at the Update Start Index
  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++ )
  {

    const SCDateTime CurrentBarDateTime = sc.BaseDateTimeIn[Index];

    const SCDateTime PreviousBarDateTime = sc.BaseDateTimeIn[max(0, Index - 1)];

    SCDateTime ResetTime;
    ResetTime.SetTime(Input_LineStopTimeInput.GetTime());

    bool NeedReset = (PreviousBarDateTime.GetTimeInSeconds() < ResetTime.GetTimeInSeconds() && CurrentBarDateTime.GetTimeInSeconds() >= ResetTime.GetTimeInSeconds())
      || (PreviousBarDateTime.GetTimeInSeconds() < ResetTime.GetTimeInSeconds() && CurrentBarDateTime.GetTimeInSeconds() < ResetTime.GetTimeInSeconds()
        && PreviousBarDateTime.GetDate() != CurrentBarDateTime.GetDate());


    NeedReset |= Index == 0;

    if (sc.BaseDateTimeIn[Index] < DaysToCalculateStartDateTime)
      continue;

    SCDateTime StartDateTime;
    SCDateTime EndDateTime;

    StartDateTime = CurrentBarDateTime.GetDate();
    EndDateTime = CurrentBarDateTime.GetDate();

    StartDateTime.SetTime(Input_StartTime.GetTime());
    EndDateTime.SetTime(Input_EndTime.GetTime());

    bool TimesAreReversed = false;
    if (Input_StartTime.GetTime() > Input_EndTime.GetTime())
    {
      TimesAreReversed = true;
      if (CurrentBarDateTime.GetTimeInSeconds() < Input_StartTime.GetTime())
      {
        StartDateTime.AddDays(-1);
      }
      else
      {
        EndDateTime.AddDays(1);
      }
    }

    if(TimesAreReversed && Input_FridayEveningExtendsIntoSunday.GetYesNo())
    {
      SCDateTime TradingDayDate(sc.GetTradingDayDate(CurrentBarDateTime));
      int DayOfWeek = TradingDayDate.GetDayOfWeek();
      if (DayOfWeek == MONDAY)
      {
        StartDateTime.AddDays(-2);
        NeedReset = false;
      }
    }

    //reset
    if (NeedReset)
    {
      HighOfPeriod = -FLT_MAX;
      LowOfPeriod = FLT_MAX;    
    }


    bool OutsideTimeRange = true;
    if (CurrentBarDateTime >= StartDateTime && CurrentBarDateTime <= EndDateTime)
    {
      OutsideTimeRange = false;

      if (HighOfPeriod < sc.BaseData[Input_InputDataHigh.GetInputDataIndex()][Index])
        HighOfPeriod = sc.BaseData[Input_InputDataHigh.GetInputDataIndex()][Index];

      if (LowOfPeriod > sc.BaseData[Input_InputDataLow.GetInputDataIndex()][Index])
        LowOfPeriod = sc.BaseData[Input_InputDataLow.GetInputDataIndex()][Index];
    }

    if (HighOfPeriod == -FLT_MAX)
      continue;

    // Set/update all values for current day
    int BackIndex = Index;

    while (true)
    {
      if(BackIndex < 0)
        break;

      const SCDateTime BackIndexDateTime = sc.BaseDateTimeIn[BackIndex];

      if (!OutsideTimeRange && BackIndexDateTime < StartDateTime)
        break;

      Subgraph_HighOfDay[BackIndex] = HighOfPeriod;
      Subgraph_LowOfDay[BackIndex] = LowOfPeriod;


      if (OutsideTimeRange || Input_DisplayHighLowIncrementally.GetYesNo())
        break;

      BackIndex--;

      if(sc.UpdateStartIndex != 0 && BackIndex >= 0)
        sc.EarliestUpdateSubgraphDataArrayIndex = BackIndex;
    }
  }
}






//xx77

SCSFExport scsf_HighLowForTimePeriodExtendedLines(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_HighOfDay = sc.Subgraph[0];
  SCSubgraphRef Subgraph_LowOfDay = sc.Subgraph[1];

  SCInputRef Input_StartTime = sc.Input[0];
  SCInputRef Input_EndTime = sc.Input[1];
  SCInputRef Input_NumberDaysToCalculate = sc.Input[2];
  SCInputRef Input_Version = sc.Input[4];
  SCInputRef Input_LineStopTimeInput = sc.Input[5];
  SCInputRef Input_DisplayHighLowIncrementally = sc.Input[6];

  SCInputRef Input_InputDataHigh = sc.Input[7];
  SCInputRef Input_InputDataLow = sc.Input[8];
  SCInputRef Input_FridayEveningExtendsIntoSunday = sc.Input[9];

  if (sc.SetDefaults)
  {
    sc.GraphName = "High/Low for Time Period - Extended";
    sc.GraphRegion = 0;
    sc.AutoLoop = 0;
    
    Subgraph_HighOfDay.Name = "High";
    Subgraph_HighOfDay.DrawStyle = DRAWSTYLE_STAIR_STEP;
    Subgraph_HighOfDay.PrimaryColor = RGB(0,255,0);
    Subgraph_HighOfDay. DrawZeros = false;
    
    Subgraph_LowOfDay.Name = "Low";
    Subgraph_LowOfDay.DrawStyle = DRAWSTYLE_STAIR_STEP;
    Subgraph_LowOfDay.PrimaryColor = RGB(255,0,255);
    Subgraph_LowOfDay.DrawZeros = false;

    Input_StartTime.Name = "Start Time";
    Input_StartTime.SetTime(0);

    Input_EndTime.Name = "End Time";
    Input_EndTime.SetTime(SECONDS_PER_DAY - 1);
  
    Input_NumberDaysToCalculate.Name= "Number Of Days To Calculate";
    Input_NumberDaysToCalculate.SetInt(120);

    Input_LineStopTimeInput.Name = "Line Stop Time";
    Input_LineStopTimeInput.SetTime(SECONDS_PER_DAY - 1);

    Input_DisplayHighLowIncrementally.Name = "Display High Low Incrementally";
    Input_DisplayHighLowIncrementally.SetYesNo( true);

    Input_InputDataHigh.Name = "Input Data High";
    Input_InputDataHigh.SetInputDataIndex(SC_HIGH);

    Input_InputDataLow.Name = "Input Data Low";
    Input_InputDataLow.SetInputDataIndex(SC_LOW);

    Input_FridayEveningExtendsIntoSunday.Name = "Friday Evening Extends Into Sunday";
    Input_FridayEveningExtendsIntoSunday.SetYesNo(false);

    Input_Version.SetInt(3);

    return;
  }

  if (Input_Version.GetInt() == 1)
  {
    Input_InputDataHigh.SetInputDataIndex(SC_HIGH);
    Input_InputDataLow.SetInputDataIndex(SC_LOW);

    Input_Version.SetInt(2);
  }

  if (Input_Version.GetInt() <= 2)
  {
    Input_LineStopTimeInput.SetTime(sc.EndTime1);
    Input_Version.SetInt(3);
  }

  if (Input_NumberDaysToCalculate.GetInt() <= 0)
    Input_NumberDaysToCalculate.SetInt(10000);
  
  float & HighOfPeriod = sc.GetPersistentFloatFast(1);
  float & LowOfPeriod = sc.GetPersistentFloatFast(2);

  const bool IsInputTimesReversed = Input_StartTime.GetTime() > Input_EndTime.GetTime();

  //Make sure the Line Stop Time is outside of the time range.
  if (IsInputTimesReversed)
  {
    if (Input_LineStopTimeInput.GetTime() >= Input_StartTime.GetTime()
      || Input_LineStopTimeInput.GetTime() < Input_EndTime.GetTime())
    {
      Input_LineStopTimeInput.SetTime(Input_EndTime.GetTime());
    }
  }
  else
  {
    if (Input_LineStopTimeInput.GetTime() >= Input_StartTime.GetTime()
      && Input_LineStopTimeInput.GetTime() < Input_EndTime.GetTime())
    {
      Input_LineStopTimeInput.SetTime(Input_EndTime.GetTime());
    }
  }

  SCDateTimeMS DaysToCalculateStartDateTime;
  DaysToCalculateStartDateTime.SetDate(sc.BaseDateTimeIn[sc.ArraySize - 1].GetDate());
  DaysToCalculateStartDateTime.SubtractDays(Input_NumberDaysToCalculate.GetInt() - 1);
  DaysToCalculateStartDateTime.SetTime(Input_StartTime.GetTime());

  if (IsInputTimesReversed)
  {
    if(sc.BaseDateTimeIn[sc.ArraySize - 1].GetTime() < Input_StartTime.GetTime())
      DaysToCalculateStartDateTime.SubtractDays(1);
  }
  

  int InitialCalculationIndex = 0;

  // Loop through chart bars starting at the Update Start Index
  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++ )
  {
    const SCDateTimeMS CurrentBarDateTime = sc.BaseDateTimeIn[Index];

    const SCDateTimeMS PreviousBarDateTime = sc.BaseDateTimeIn[max(0, Index - 1)];
    const SCDateTimeMS NextBarDateTime = sc.BaseDateTimeIn[Index + 1];

    SCDateTimeMS ResetTime;
    ResetTime.SetDate(CurrentBarDateTime.GetDate());
    ResetTime.SetTime(Input_LineStopTimeInput.GetTime());

    bool NeedReset =
      (PreviousBarDateTime < ResetTime && CurrentBarDateTime >= ResetTime);


    NeedReset |= Index == InitialCalculationIndex;

    if (sc.BaseDateTimeIn[Index] < DaysToCalculateStartDateTime)
    {
      InitialCalculationIndex = Index + 1;
      continue;
    }

    SCDateTimeMS StartDateTime;
    SCDateTimeMS EndDateTime;

    StartDateTime = CurrentBarDateTime.GetDate();
    EndDateTime = CurrentBarDateTime.GetDate();

    StartDateTime.SetTime(Input_StartTime.GetTime());
    EndDateTime.SetTime(Input_EndTime.GetTime());

    if (IsInputTimesReversed)
    {
      if (CurrentBarDateTime.GetTimeInSeconds() < Input_StartTime.GetTime())
      {
        StartDateTime.SubtractDays(1);
      }
      else
      {
        EndDateTime.AddDays(1);
      }
    }

    if(IsInputTimesReversed && Input_FridayEveningExtendsIntoSunday.GetYesNo())
    {
      SCDateTime TradingDayDate(sc.GetTradingDayDate(CurrentBarDateTime));
      int DayOfWeek = TradingDayDate.GetDayOfWeek();
      if (DayOfWeek == MONDAY)
      {
        StartDateTime.SubtractDays(2);
        NeedReset = false;
      }
    }

    //reset
    if (NeedReset)
    {
      HighOfPeriod = -FLT_MAX;
      LowOfPeriod = FLT_MAX;    
    }


    bool OutsideTimeRange = true;

    bool IsCurrentBarContainingOrGreaterThanStartDateTime =
      (CurrentBarDateTime < StartDateTime
        && NextBarDateTime > StartDateTime)
      || CurrentBarDateTime >= StartDateTime;

    if (IsCurrentBarContainingOrGreaterThanStartDateTime && CurrentBarDateTime <= EndDateTime)
    {
      OutsideTimeRange = false;

      if (HighOfPeriod < sc.BaseData[Input_InputDataHigh.GetInputDataIndex()][Index])
        HighOfPeriod = sc.BaseData[Input_InputDataHigh.GetInputDataIndex()][Index];

      if (LowOfPeriod > sc.BaseData[Input_InputDataLow.GetInputDataIndex()][Index])
        LowOfPeriod = sc.BaseData[Input_InputDataLow.GetInputDataIndex()][Index];
    }

    if (HighOfPeriod == -FLT_MAX)
      continue;

    // Set/update all values for current day
    int BackIndex = Index;

    while (true)
    {
      if(BackIndex < 0)
        break;

      const SCDateTimeMS BackIndexDateTime = sc.BaseDateTimeIn[BackIndex];
      const SCDateTimeMS NextBackIndexDateTime = sc.BaseDateTimeIn[BackIndex+1];

      bool IsCurrentBarContainingOrGreaterThanStartDateTime =
        (BackIndexDateTime < StartDateTime
          && NextBackIndexDateTime > StartDateTime)
        || BackIndexDateTime >= StartDateTime;

      if (!OutsideTimeRange && !IsCurrentBarContainingOrGreaterThanStartDateTime)
        break;

      Subgraph_HighOfDay[BackIndex] = HighOfPeriod;
      Subgraph_LowOfDay[BackIndex] = LowOfPeriod;


      if (OutsideTimeRange || Input_DisplayHighLowIncrementally.GetYesNo())
        break;

      BackIndex--;

      if(sc.UpdateStartIndex != 0 && BackIndex >= 0)
        sc.EarliestUpdateSubgraphDataArrayIndex = BackIndex;
    }
  }
}


[2020-10-08 18:14:21]
Ackin - Posts: 1865
User791968
I installed the previous version(2168) and it started working correctly again.

Keep Sierrachart version 2168 for now. SC support reads every thread, so it knows about it, if it's a bug, then fix it in future versions, if not and it should work as in version 2177, you still have the option to compile the old version of the study as a standalone library.

If you want advice on how to create it or a library, write me a DM or email zyp.sierra@gmail.com
Date Time Of Last Edit: 2020-10-08 18:48:08

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

Login

Login Page - Create Account