Login Page - Create Account

Support Board


Date/Time: Sun, 16 Mar 2025 02:41:32 +0000



Post From: Pass Array from GetStudyLineUntilFutureIntersectionByIndex to SubGraph

[2022-08-03 20:06:10]
BombaFett - Posts: 3
Ahh I see it now...I thought I was just initializing the variable lol.

Thank you for including the documentation on Auto Looping, I actually never realized sc.Index referred to the BarNumber. It made so much more sense after reading.

Thanks again for your help!

Working code for posterity :)
SCSFExport scsf_IntersectionLines(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_IntersectionLines = sc.Subgraph[0];

  if (sc.SetDefaults)
  {
    sc.GraphName = "Reference Study with Add Until Line Intersection Data";
    sc.StudyDescription = "Referencing Add Until Line Intersection data from other studies on the chart.";
    Subgraph_IntersectionLines.Name = "Line Properties";
    Subgraph_IntersectionLines.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_IntersectionLines.LineWidth = 2;
    Subgraph_IntersectionLines.PrimaryColor = COLOR_DARKORANGE;
    Subgraph_IntersectionLines.DrawZeros = false;
    sc.AutoLoop = 1;

    // low precedence level to ensure other studies are calculated first.

    sc.CalculationPrecedence = LOW_PREC_LEVEL;
    sc.Input[1].Name = "Study Reference with Add Until Line Intersection";
    sc.Input[1].SetStudyID(1);
    return;
  }

  int LineIDForBar = 0;
  int StartIndex = 0;
  float LineValue = 0;
  int EndIndex = 0;

  sc.GraphRegion = 0;


const int LineIndexArraySize = sc.GetNumLinesUntilFutureIntersection(sc.ChartNumber, sc.Input[1].GetStudyID());

for (int LineIndex = 0; LineIndex < LineIndexArraySize; ++LineIndex)
{
sc.GetStudyLineUntilFutureIntersectionByIndex(sc.ChartNumber, sc.Input[1].GetStudyID(), LineIndex, LineIDForBar, StartIndex, LineValue, EndIndex);
  Subgraph_IntersectionLines[sc.Index] = LineValue;
  }
}

Date Time Of Last Edit: 2022-08-03 22:08:00