Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 17:49:54 +0000



Post From: ACSIL: UseTool

[2016-03-22 09:01:04]
Sierra Chart Engineering - Posts: 104368
Here is a code example we put together and tested to work:


SCSFExport scsf_UseToolExampleText(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Text";
    sc.StudyDescription = "User drawn text drawing example.";

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

    return;
  }


  int &TextDrawingLineNumber = sc.GetPersistentInt(1);

  if (TextDrawingLineNumber != 0 && sc.LastCallToFunction)
  {
    // Be sure to remove the Text drawing added as a user drawn drawing
    sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, TextDrawingLineNumber);
    return;//No further processing needed in this case.
  }

  // Do data processing  
  int BarIndex = sc.ArraySize - 20;

  if (BarIndex < 0)
    return;

  s_UseTool TextDrawing;
  TextDrawing.Clear();//Not necessary but good practice
  TextDrawing.ChartNumber = sc.ChartNumber;
  TextDrawing.DrawingType = DRAWING_TEXT;
  
  if(TextDrawingLineNumber != 0)
    TextDrawing.LineNumber = TextDrawingLineNumber;
  
  TextDrawing.AddAsUserDrawnDrawing = 1;
  
  TextDrawing.BeginIndex = BarIndex;
  TextDrawing.BeginValue = sc.High[BarIndex];
  TextDrawing.Color = COLOR_KHAKI;
  TextDrawing.Text = "Movable User Drawn Text Example";
  TextDrawing.FontSize = 18;
  // do not keep adjusting
  TextDrawing.AddMethod = UTAM_ADD_ONLY_IF_NEW;

  sc.UseTool(TextDrawing);

  //Remember the line number which has been automatically assigned
  TextDrawingLineNumber = TextDrawing.LineNumber;
}

To move the text drawing make sure a non-drawing tool is selected like Tools >> Pointer.

Make sure you also have not locked the drawing.
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
Date Time Of Last Edit: 2016-03-22 09:03:29