Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 20:25:40 +0000



Does this code serve any purpose?

View Count: 1003

[2014-09-26 11:58:42]
David_M - Posts: 14
I'm trying to learn the SC language and I can't see the purpose of the 'Unused' and 'Version' InputRef. The output seems to be the same when these lines are commented out, or included. Am I missing something?
Thanks

SCSFExport scsf_HighestHighLowestLowOverNBars(SCStudyInterfaceRef sc)
{
  SCSubgraphRef HighestHigh = sc.Subgraph[0];
  SCSubgraphRef LowestLow = sc.Subgraph[1];

  SCInputRef Length = sc.Input[3];
  //SCInputRef Unused = sc.Input[4];
  SCInputRef InputDataHigh = sc.Input[5];
  SCInputRef InputDataLow = sc.Input[6];
  //SCInputRef Version = sc.Input[7];

  if (sc.SetDefaults)
  {
    sc.GraphName = "Highest High / Lowest Low Over N Bars";

    sc.GraphRegion = 0;
    sc.AutoLoop = 1;
    sc.FreeDLL = 1;
    
    HighestHigh.Name= "Highest High";
    HighestHigh.DrawStyle = DRAWSTYLE_LINE;
    HighestHigh.PrimaryColor = RGB(0,255,0);
    HighestHigh.DrawZeros = true;

    LowestLow.Name = "Lowest Low";
    LowestLow.DrawStyle = DRAWSTYLE_LINE;
    LowestLow.PrimaryColor = RGB(255,0,255);
    LowestLow.DrawZeros = true;

    Length.Name = "Length";
    Length.SetInt(5);
    Length.SetIntLimits(1, MAX_STUDY_LENGTH);

    InputDataHigh.Name = "Input Data High";
    InputDataHigh.SetInputDataIndex(SC_HIGH);

    InputDataLow.Name = "Input Data Low";
    InputDataLow.SetInputDataIndex(SC_LOW);

    //Version.SetYesNo(1);

    return;
  }

  //if(Version.GetYesNo() == 0)
  //{
  //  InputDataHigh.SetInputDataIndex(SC_HIGH);
  //  InputDataLow.SetInputDataIndex(SC_LOW);
  //  Version.SetYesNo(1);
  //}

  sc.DataStartIndex = (int)(Length.GetInt()) - 1; //+ Unused.GetFloat());

  if (sc.Index < sc.DataStartIndex)
    return;

  double Lowest = FLT_MAX;
  double Highest = -FLT_MAX;
  for(int i1 = sc.Index - (Length.GetInt() - 1); i1<= sc.Index; i1++)
  {
    if(Highest < sc.BaseDataIn[InputDataHigh.GetInputDataIndex()][i1])
      Highest = sc.BaseDataIn[InputDataHigh.GetInputDataIndex()][i1];

    if(Lowest > sc.BaseDataIn[InputDataLow.GetInputDataIndex()][i1])
      Lowest = sc.BaseDataIn[InputDataLow.GetInputDataIndex()][i1];
  }

  HighestHigh[sc.Index] = (float)Highest;
  LowestLow[sc.Index] = (float)Lowest;
}
Date Time Of Last Edit: 2014-09-26 18:52:27
[2014-09-28 06:50:12]
Sierra Chart Engineering - Posts: 104368
At this point in time the Version input really is not needed and we have removed it. It previously was needed for back compatibility.

We do not know why the Unused input was still left there. It has been removed as well.
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

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

Login

Login Page - Create Account