Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 16:01:17 +0000



Post From: cci basing the 0 line on the open of the day instead of the MA leght.

[2017-07-25 15:24:07]
ozunainc - Posts: 16
can anyone help me do this. what I want to do is make the 0-line to calculate the price from the opening of the day. i'm in the south east so to me the opening is 17:00. (cruel oil market or futures). please see below, I'm not a coder by any means. I try changing the input for line one which is the zero line. thanks in advance.


SCSFExport scsf_CommodityChannelIndex(SCStudyInterfaceRef sc)
{
  SCInputRef I_InputData = sc.Input[0];
  SCInputRef I_Length = sc.Input[3];
  SCInputRef I_Multiplier = sc.Input[4];
  SCInputRef I_Line2Value = sc.Input[5];
  SCInputRef I_Line3Value = sc.Input[6];
  SCInputRef I_MAType = sc.Input[7];
  SCInputRef I_Version = sc.Input[8];

  SCSubgraphRef CCI = sc.Subgraph[0];
  SCSubgraphRef Line1 = sc.Subgraph[1];
  SCSubgraphRef Line2 = sc.Subgraph[2];
  SCSubgraphRef Line3 = sc.Subgraph[3];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Commodity Channel Index";
    

    sc.FreeDLL = 0;
    sc.AutoLoop = 1; // true
    sc.GraphRegion = 1;
    sc.ValueFormat = 2;

    CCI.Name = "CCI";
    CCI.DrawStyle = DRAWSTYLE_BAR;
    CCI.PrimaryColor = RGB(0,255,0);
    CCI.DrawZeros= true;

    Line1.Name = "Line 1";
    Line1.DrawStyle = DRAWSTYLE_HIDDEN;
    Line1.PrimaryColor = RGB(255,0,255);
    Line1.DrawZeros= [SC_OPEN];

    Line2.Name = "Line 2";
    Line2.DrawStyle = DRAWSTYLE_LINE;
    Line2.PrimaryColor = RGB(255,255,0);
    Line2.DrawZeros = false;

    Line3.Name = "Line 3";
    Line3.DrawStyle = DRAWSTYLE_LINE;
    Line3.PrimaryColor = RGB(255,127,0);
    Line3.DrawZeros = false;


    I_InputData.Name = "Input Data";
    I_InputData.SetInputDataIndex(SC_HLC);

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

    I_Multiplier.Name = "Multiplier";
    I_Multiplier.SetFloat(0.015f);

    I_Line2Value.Name = "Line2 Value";
    I_Line2Value.SetFloat(100);

    I_Line3Value.Name = "Line3 Value";
    I_Line3Value.SetFloat(-100);

    I_MAType.Name = "Moving Average Type";
    I_MAType.SetMovAvgType(MOVAVGTYPE_SIMPLE);

     I_Version.SetInt(1);

    return;
  }


  if(I_Version.GetInt() < 1)
  {
    I_Version.SetInt(1);
    I_MAType.SetMovAvgType(MOVAVGTYPE_SIMPLE);
  }

  sc.DataStartIndex = I_Length.GetInt();

  float Multiplier = I_Multiplier.GetFloat();

  if(Multiplier == 0.0f)
    Multiplier = 0.015f;

  sc.CCI(sc.BaseDataIn[I_InputData.GetInputDataIndex()], CCI, sc.Index, I_Length.GetInt(), Multiplier, I_MAType.GetMovAvgType());

  Line2[sc.Index] = I_Line2Value.GetFloat();
  Line3[sc.Index] = I_Line3Value.GetFloat();
}