Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 03:04:56 +0000



Perplexing Subgraph value error.

View Count: 202

[2024-04-04 00:54:04]
Flipper_2 - Posts: 57
I am trying to track a variable in a subgraph but after hours of going around in circles I cannot resolve why a subgraph value cannot be set to a specific value.

That value is 20231211 but it always overflows to 20231212!! No matter how I code it see attached code. As you can see three subgraphs being set to 20231211 in the code but the subgraph value always has 20231212. Even -20231211 doesn't work.

Is this a bug??


SCSFExport scsf_TestSubgraph(SCStudyInterfaceRef sc)
{
  SCSubgraphRef DayNumber = sc.Subgraph[0];
  SCSubgraphRef SecondNumber = sc.Subgraph[1];
  SCSubgraphRef ThirdNumber = sc.Subgraph[2];

  if (sc.SetDefaults)
  {
    sc.GraphName = "Test";
    sc.AutoLoop = 1;

    DayNumber.Name = "Number";
    DayNumber.DrawStyle = DRAWSTYLE_IGNORE;
    DayNumber.PrimaryColor = RGB(0, 206, 206);

    SecondNumber.Name = "SecondNumber";
    SecondNumber.DrawStyle = DRAWSTYLE_IGNORE;
    SecondNumber.PrimaryColor = RGB(0, 206, 206);

    ThirdNumber.Name = "ThirdNumber";
    ThirdNumber.DrawStyle = DRAWSTYLE_IGNORE;
    ThirdNumber.PrimaryColor = RGB(0, 206, 206);

    return;
  }

  int testnumber = 20231211;

  DayNumber[sc.Index] = static_cast<float>(testnumber);

  SecondNumber[sc.Index] = 20231211.0;

  if (SecondNumber[sc.Index] != 20231211.0) {

    SCString BarDateTime = sc.DateTimeToString(sc.BaseDateTimeIn[sc.Index], FLAG_DT_COMPLETE_DATETIME);

    sc.AddMessageToLog(SCString().Format("%s - SecondNumber: %f", BarDateTime.GetChars(), SecondNumber[sc.Index]), 0);

  }

  ThirdNumber[sc.Index] = -20231211.0;

}

Have updated to latest version and tried on two different computers but still same result.
Date Time Of Last Edit: 2024-04-04 00:55:59
image2024-04-04 11_33_39-Small_indicators (Debugging) - Microsoft.png / V - Attached On 2024-04-04 00:42:48 UTC - Size: 155.18 KB - 65 views
image2024-04-04 11_27_09-NQM24-CME [C][M] 15 Min #2 - Chart Val.png / V - Attached On 2024-04-04 00:54:44 UTC - Size: 56.26 KB - 47 views
[2024-04-04 05:26:20]
Sierra_Chart Engineering - Posts: 17166
This is because the Sierra Chart Study Subgraph arrays, are 4 byte single precision floating-point value arrays. They do not have the precision to fully represent that number. If we go to 8 byte floats, then the memory use of Sierra Chart increases significantly.

We have considered that, but there will be significantly increased memory use.
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