Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 01:13:37 +0000



Understanding arrays.

View Count: 735

[2020-07-21 09:53:24]
gfx2trade - Posts: 48
Hi SC Team,
I am still confused with handling arrays.
Below my cpp code which works fine.
// Graphs & Input
    SCSubgraphRef Subgraph_Highest = sc.Subgraph[0];
    SCSubgraphRef Subgraph_Lowest = sc.Subgraph[1];
  
  // Working
    

  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "TEST HL";
    sc.StudyDescription = "This is the gfx KiJun-Sen indicator";
    sc.DrawZeros = false;
    sc.GraphRegion = 0;
    sc.ValueFormat = sc.BaseGraphValueFormat;
    
    Subgraph_Highest.Name = "RBH";
    Subgraph_Highest.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_Highest.LineWidth = 1;  //Width of arrow
    Subgraph_Highest.PrimaryColor = RGB (0, 0, 255); // Green
    
    Subgraph_Lowest.Name = "RBL";
    Subgraph_Lowest.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_Lowest.LineWidth = 1;  //Width of arrow
    Subgraph_Lowest.PrimaryColor = RGB (0, 0, 255); // Green
    
    sc.AutoLoop = 1;
    
    sc.AlertOnlyOncePerBar = true;
    
    return;
  }
    
  // ************************************  
  // Section 2 - Do data processing here
  // ************************************  
  
  int index = sc.Index;
  int OutputIndex = index + 0;
  
  sc.Highest(sc.BaseDataIn[SC_HIGH], sc.Subgraph[0], 20);
  sc.Lowest(sc.BaseDataIn[SC_LOW], sc.Subgraph[1], 20);


Is there a way to avoid using sc.Subgraph[] to store intermediate data.

Eventually I would like to end up with ...

SCSubgraphRef Subgraph_Mid = sc.Subgraph[0];

sc.Highest(sc.BaseDataIn[SC_HIGH], A, 20);
  sc.Lowest(sc.BaseDataIn[SC_LOW], B, 20);

Subgraph_Mid[index] = (A+B)/2

Thks
[2020-07-21 09:58:18]
Sierra Chart Engineering - Posts: 104368
Use these arrays to store intermediate data:
ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].Arrays[][]

Working with ACSIL Arrays and Understanding Looping: Overview of sc.BaseData[][]sc.Subgraph[].Data[]sc.Subgraph[].Arrays[][]
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-07-21 09:58:57

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

Login

Login Page - Create Account