Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 16:24:46 +0000



Creating a Chart Drawing DRAWING_HORIZONTAL_LINE_NON_EXTENDED -Sets Wrong Year on End Time

View Count: 305

[2023-01-05 16:53:13]
Sierra123 - Posts: 21
I think I found a bug in the SierraChart code.

I have a function which uses sc.UseTool() to create a line using DRAWING_HORIZONTAL_LINE_NON_EXTENDED, with the Tool.EndDateTime set to a date in the year 2022. I print out the value before calling the function using the GetYear() and verified it is set correctly, but then I look up on the UI Manage Chart Drawings and the anchor is set to the year 2023 (current year). The month,day,hour,minute,second values are correct, just the year is wrong. I also verified by looking up the drawing after creating it and printing out the EndDateTime and also saw it was set to 2023.

The StartDateTime field works correctly when using prior years.



Please update me.
Thank you.
[2023-01-08 00:01:33]
Sierra_Chart Engineering - Posts: 13609
We tested this and cannot reproduce this. This is the test code that we used:
SCSFExport scsf_UseToolExampleDrawingHorizontalLineNonExtended(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Horizontal Line Non-Extended";
    sc.GraphRegion = 0;

    sc.AutoLoop = 0; //No automatic looping

    return;
  }

  // Do data processing  

  int& r_LineNumber = sc.GetPersistentInt(1);

  s_UseTool Tool;

  Tool.ChartNumber = sc.ChartNumber;
  Tool.DrawingType = DRAWING_HORIZONTAL_LINE_NON_EXTENDED;

  if (r_LineNumber != 0)
    Tool.LineNumber = r_LineNumber;

  // Set BarIndex to 50 bars from the end
  int BarIndex = sc.ArraySize - 50;
  BarIndex = max(BarIndex, 0);

  Tool.BeginValue = sc.Close[BarIndex];

  Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
  Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize - 3];

  Tool.Color = RGB(255, 0, 0);
  Tool.LineWidth = 10;
  Tool.Region = 0;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;

  sc.UseTool(Tool); // Here we make the function call to add the line

  r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set
}

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
Date Time Of Last Edit: 2023-01-08 00:02:02
[2023-01-09 22:43:49]
Sierra123 - Posts: 21
Where in your example do you set either the Begin or End Date time to be a date in 2022?
[2023-01-09 22:52:06]
John - SC Support - Posts: 30428
It is being set by the Date/Time of the BarIndex. In particular it starts at 50 bars prior to most current bar (sc.ArraySize - 50) and ends at 3 bars prior to the most current bar (sc.ArraySize - 3)
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-01-10 14:26:54]
Sierra123 - Posts: 21
I found the bug in my application when I was trying to make a sample to provide you. My apologies. Thank you for looking into it.

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

Login

Login Page - Create Account