Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 18:43:59 +0000



[Programming Help] - ACSIL Extended Line Until Bar Close

View Count: 170

[2023-05-22 21:16:51]
MPicciuto - Posts: 9
Hello everyone,

I was wondering if anyone knew how to make this line extend until the close of the candle that crosses it instead of just the wicks. Here's my code below. I can't seem to find anything in the documentation about this, if anyone can shine some light I'd very much appreciate it.
Thanks.
#include "sierrachart.h"

SCDLLName("WSS Measured Move")

SCSFExport scsf_MeasuredMoveFunction(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_LinePropertiesSubgraph = sc.Subgraph[0];
  SCInputRef Input_DisplayValueLabel = sc.Input[0];
  SCInputRef Input_NameLabel = sc.Input[1];

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

    sc.GraphName = "WSS Measured Move";

    Subgraph_LinePropertiesSubgraph.Name = "Line Properties";
    Subgraph_LinePropertiesSubgraph.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_LinePropertiesSubgraph.LineStyle = LINESTYLE_DASH;
    Subgraph_LinePropertiesSubgraph.LineWidth = 2;
    Subgraph_LinePropertiesSubgraph.PrimaryColor = COLOR_GREEN;
    Subgraph_LinePropertiesSubgraph.DrawZeros = false;

    Input_DisplayValueLabel.Name = "Display Value Label";
    Input_DisplayValueLabel.SetYesNo(false);

    Input_NameLabel.Name = "Name Label";
    Input_NameLabel.SetString("");

    sc.ValueFormat = VALUEFORMAT_INHERITED;

    sc.GraphRegion = 0;

    sc.AutoLoop = 1;

    return;
  }

  
  if (sc.Index == 0)
    return;

  float ExtendPrice = 0.0;
  
  sc.ATR(sc.BaseDataIn, sc.Subgraph[0], 13, MOVAVGTYPE_SIMPLE);

  float ATR = sc.Subgraph[0][sc.Index];
  float BarRange = sc.High[sc.Index] - sc.Low[sc.Index];
  
  if(sc.Open[sc.Index] < sc.Close[sc.Index] && BarRange > (1.75 * ATR) && sc.Close[sc.Index] > (sc.Low[sc.Index] + (BarRange / 2)))
    ExtendPrice = sc.Open[sc.Index];
    

  SCString NameLabelString = Input_NameLabel.GetString();

  bool DisplayNameLabel = false;

  if (NameLabelString != NULL && strlen(NameLabelString) > 0)
    DisplayNameLabel = true;
  else
    NameLabelString.Clear();
  

  sc.AddLineUntilFutureIntersection
    ( sc.Index
    , 0 // LineIDForBar. Use 0 since there is only one line per bar.
    , ExtendPrice
    , Subgraph_LinePropertiesSubgraph.PrimaryColor
    , Subgraph_LinePropertiesSubgraph.LineWidth
    , Subgraph_LinePropertiesSubgraph.LineStyle
    , Input_DisplayValueLabel.GetYesNo()
    , DisplayNameLabel
    , NameLabelString
    );

}

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

Login

Login Page - Create Account