Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 07:14:34 +0000



Post From: Setting drawing LineNumber to price in ticks, then erasing if price met

[2016-09-28 19:16:42]
Sierra Chart Engineering - Posts: 104368
Here is a code example:


SCSFExport scsf_DeleteACSChartDrawingExample(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "Delete ACS Chart Drawing Example";
    sc.StudyDescription = "";

    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0; //No automatic looping

    return;
  }

  int& LineNumber = sc.GetPersistentInt(1);

  //Only do processing on the last bar
  if (sc.IsFullRecalculation)
  {
    //Set the previously remembered line number to 0 because on a full recalculation advanced custom study drawings are automatically deleted
    LineNumber = 0;
    return;
  }



  if(LineNumber != 0)
  {
    int Result = sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING, LineNumber);
    LineNumber = 0;
  }

  s_UseTool Tool;

  Tool.ChartNumber = sc.ChartNumber;
  //Tool.LineNumber will be automatically set. No need to set this.
  Tool.DrawingType = DRAWING_MARKER;
  Tool.BeginIndex = sc.ArraySize - 1;

  Tool.MarkerType = MARKER_ARROWUP;
  Tool.BeginValue = sc.Low[sc.ArraySize - 1];


  Tool.Region = 0;
  Tool.Color = RGB(0, 255, 0);
  Tool.MarkerSize = 8;
  Tool.LineWidth = 4;
  Tool.AddMethod = UTAM_ADD_ALWAYS;

  sc.UseTool(Tool); // Here we make the function call to add the marker

  //Remember the line number so it can be deleted at the beginning of the function when set
  LineNumber = Tool.LineNumber;

}

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