Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 06:20:24 +0000



[Programming Help] - ACSIL - Only three Subrahps are being displayed on Chart

View Count: 644

[2019-07-12 12:46:51]
User722856 - Posts: 78
Dear Sirs,

I have programmed a simple study where i want to show four Lines (= Subgraphs) on my Chart.
Unfortunately always only three are displayed by Sierra.

--> sc.Subgraph[4] is not being plotted, why not?
Did i something wrong or is this a bug?

As far as i know (from the official documentation) 60 subgraphs are available.

Please find the code and screenshot bellow.

Thank you very much in advance.

/*============================================================================
This function demonstrates manual Subraph looping using a for loop.
----------------------------------------------------------------------------*/
SCSFExport scsf_ExampleSubgraph(SCStudyInterfaceRef sc)
{

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Subgraph Example";

    sc.StudyDescription = "This is an example of using manual looping in Subgraph.";
    sc.AutoLoop = 0; // 0 is the default: there is no auto-looping
    sc.GraphRegion = 0; // Use the main price graph region (0 means Chart Region 1, 1 means Chart Region 2, maximum value can be 7=Region 8)


    sc.Subgraph[1].Name = "High-Min";
    sc.Subgraph[2].Name = "High-Max";

    sc.Subgraph[3].Name = "Low-Min";
    sc.Subgraph[4].Name = "Low-Max";


    return;
  }

  // Do data processing
  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
  {
    //================================================================================
    // Calculate the Upper Range (from Daily Low)
    //================================================================================
    // Calculate the Upper Range (from Daily Low) - High-Min:
    sc.Subgraph[1][Index] = sc.BaseData[SC_LOW][Index] + 20;
    // Calculate the Upper Range (from Daily Low) - High-Max:
    sc.Subgraph[2][Index] = sc.BaseData[SC_LOW][Index] + 40;


    //================================================================================
    // Calculate the Lower Range (from Daily High)
    //================================================================================
    // Calculate the Lower Range (from Daily High) - Low-Min:
    sc.Subgraph[3][Index] = sc.BaseData[SC_HIGH][Index] - 20;
    // Calculate the Lower Range (from Daily High) - Low-Max:
    sc.Subgraph[4][Index] = sc.BaseData[SC_HIGH][Index] - 40;
  }
}

Date Time Of Last Edit: 2019-07-12 13:00:19
imagesierra.png / V - Attached On 2019-07-12 12:44:49 UTC - Size: 25.19 KB - 230 views
[2019-07-12 13:05:09]
Ackin - Posts: 1865
[4] was ignored (as DRAWSTYLE)


SCSFExport scsf_ExampleSubgraph(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Subgraph Example";

    sc.StudyDescription = "This is an example of using manual looping in Subgraph.";
    sc.AutoLoop = 0; // 0 is the default: there is no auto-looping
    sc.GraphRegion = 0; // Use the main price graph region (0 means Chart Region 1, 1 means Chart Region 2, maximum value can be 7=Region 8)

    sc.Subgraph[1].Name = "High-Min";
    sc.Subgraph[1].DrawStyle = DRAWSTYLE_LINE;

    sc.Subgraph[2].Name = "High-Max";
    sc.Subgraph[2].DrawStyle = DRAWSTYLE_LINE;

    sc.Subgraph[3].Name = "Low-Min";
    sc.Subgraph[3].DrawStyle = DRAWSTYLE_LINE;

    sc.Subgraph[4].Name = "Low-Max";
    sc.Subgraph[4].DrawStyle = DRAWSTYLE_LINE;
    return;
  }

  // Do data processing

  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
  {
    //================================================================================
    // Calculate the Upper Range (from Daily Low)
    //================================================================================

    // Calculate the Upper Range (from Daily Low) - High-Min:
    sc.Subgraph[1][Index] = sc.BaseData[SC_LOW][Index] + 20;

    // Calculate the Upper Range (from Daily Low) - High-Max:
    sc.Subgraph[2][Index] = sc.BaseData[SC_LOW][Index] + 40;


    //================================================================================
    // Calculate the Lower Range (from Daily High)
    //================================================================================

    // Calculate the Lower Range (from Daily High) - Low-Min:
    sc.Subgraph[3][Index] = sc.BaseData[SC_HIGH][Index] - 20;

    // Calculate the Lower Range (from Daily High) - Low-Max:
    sc.Subgraph[4][Index] = sc.BaseData[SC_HIGH][Index] - 40;
  }

}

Date Time Of Last Edit: 2019-07-12 13:08:12
[2019-07-12 13:12:46]
User722856 - Posts: 78
@Ackin
[4] was ignored (as DRAWSTYLE)

Thanks for the Response.
How do I achieve that it wont be ignored?
[2019-07-12 13:54:17]
Ackin - Posts: 1865
How do I achieve that it wont be ignored?

ACSIL) add this line:
sc.Subgraph[4].DrawStyle = DRAWSTYLE_LINE;

or manually)
in Study settings in TAB "Subgraphs" change DRAWSTYLE from "IGNORE" to "LINE"
Date Time Of Last Edit: 2019-07-12 13:55:43
imagesubgraphs.png / V - Attached On 2019-07-12 13:54:14 UTC - Size: 77.6 KB - 238 views
[2019-07-12 19:57:33]
User722856 - Posts: 78
Thanks it works now!!!

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

Login

Login Page - Create Account