Login Page - Create Account

Support Board


Date/Time: Mon, 07 Jul 2025 01:49:34 +0000



Post From: Help with custom horizontal study.

[2019-04-09 22:27:00]
ozunainc - Posts: 16
I just hope everyone could came with the own strategy and make money. thanks to ackin again.... enjoy. and to sierra chart if you like place this on the user contribute file. as promise...


// For reference, refer to this page:
// Advanced Custom Study Interface and Language (ACSIL)

// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.
SCDLLName("auto horizontal line dll")

//This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require.
//*============================================================================*//


SCSFExport scsf_AutoHorizontalLine(SCStudyGraphRef sc)
{
  SCSubgraphRef L1 = sc.Subgraph[0];
  SCSubgraphRef L2 = sc.Subgraph[1];
  SCSubgraphRef L3 = sc.Subgraph[2];
  SCSubgraphRef L4 = sc.Subgraph[3];    
  SCSubgraphRef L5 = sc.Subgraph[4];
  
  


  SCInputRef GridStart = sc.Input[0];
  SCInputRef GridSpacing = sc.Input[1];
  SCInputRef GridSpacingNegative = sc.Input[2];

  

  if (sc.SetDefaults)
  {
    sc.GraphName = "Ozuna Grid";

    sc.ScaleRangeType = SCALE_AUTO;
    sc.DrawZeros = true;
    sc.GraphRegion = 0;
    sc.ValueFormat = 3;
    sc.AutoLoop = 1;
    sc.FreeDLL= 1;

    GridStart.Name = "Grid Starting Number";
    GridStart.SetStudySubgraphValues(0,0);
    GridSpacing.Name = "Grid Spacing";
    GridSpacing.SetFloat(0.0f);
    GridSpacingNegative.Name = "Grid SpacingNegative";
    GridSpacingNegative.SetFloat(-0.0f);

    L1.Name = "L1";
    L2.Name = "L2";
    L3.Name = "L3";
    L4.Name = "L4";
    L5.Name = "L5";
    
  


    return;

  }

  float GridSpacingVal = GridSpacing.GetFloat();
  float GridSpacingValNegative = GridSpacingNegative.GetFloat();
  
  SCFloatArray Study1Array;
  sc.GetStudyArrayUsingID(GridStart.GetStudyID(),GridStart.GetSubgraphIndex(),Study1Array);
  float GridStartVal = Study1Array[sc.Index];

  L1[sc.Index] = GridStartVal+GridSpacingVal;
  L2[sc.Index] = GridStartVal+GridSpacingVal*2;
  L3[sc.Index] = GridStartVal+GridSpacingVal*3;
  L4[sc.Index] = GridStartVal+GridSpacingValNegative*1;
  L5[sc.Index] = GridStartVal+GridSpacingValNegative*2;


}