Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 18:25:19 +0000



Post From: Line Study Source code

[2024-10-06 19:56:38]
gcUserStudies - Posts: 106
Using the study name you posted... You can search each Studiesx.cpp file in the ACS_Source directory. Example, I searched for scsf_Line. I'm showing it's in Studies7.cpp


/*==========================================================================*/
SCSFExport scsf_Line(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Line = sc.Subgraph[0];
  SCInputRef Input_Value = sc.Input[3];
  SCInputRef Input_NumberOfDaysToCalculate = sc.Input[0];

  if (sc.SetDefaults)
  {
    sc.GraphName = "Line";

    sc.GraphRegion = 1;
    sc.ValueFormat = 2;
    sc.AutoLoop = 1;

    Subgraph_Line.Name = "Line";
    Subgraph_Line.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_Line.PrimaryColor = RGB(0,255,0);
    Subgraph_Line.DrawZeros = 1;

    Input_Value.Name = "Value";
    Input_Value.SetFloat(1.0f);

    Input_NumberOfDaysToCalculate.Name = "Number of Days to Calculate";
    Input_NumberOfDaysToCalculate.SetInt(0);

    sc.DataStartIndex = 0;

    return;
  }

  if(Input_NumberOfDaysToCalculate.GetInt() > 0)
  {
    Subgraph_Line.DrawZeros = 0;

    const SCDateTime TradingDayDateForLastBar = sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.ArraySize - 1]);

    const SCDateTime TradingDayDateForBar = sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.Index]);

    if ((TradingDayDateForLastBar.GetDate() - TradingDayDateForBar.GetDate() + 1)
  > Input_NumberOfDaysToCalculate.GetInt())
    {
      return;
    }
  }

  Subgraph_Line[sc.Index] = Input_Value.GetFloat();
}