Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 09:51:21 +0000



[Programming Help] - Stationary Text from ACSIL

View Count: 2234

[2017-10-31 14:11:37]
cross - Posts: 70
Text moves to the left with the chart which is not the expected behaviour (imo).


    TextTool.DrawingType = DRAWING_STATIONARY_TEXT;
    TextTool.AddMethod = UTAM_ADD_OR_ADJUST;
    TextTool.AddAsUserDrawnDrawing = 1;
    TextTool.UseRelativeVerticalValues = 1;
    TextTool.BeginDateTime = 80;
    TextTool.BeginValue = 90;

Thanks
[2017-11-01 17:04:29]
Sierra Chart Engineering - Posts: 104368
We will be testing this.
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
[2017-11-03 01:59:56]
Sierra Chart Engineering - Posts: 104368
We do not see any problem. The Text remains stationary.

Here is example code you can use:
/*==========================================================================*/
SCSFExport scsf_UseToolExampleStationaryText(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Stationary Text";
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0; //No automatic looping
    return;
  }

  int &TextDrawingLineNumber = sc.GetPersistentInt(1);

  if (sc.LastCallToFunction)
  {
    if (TextDrawingLineNumber != 0)
    {
      // Be sure to remove the Text drawing added as a user drawn drawing
      sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, TextDrawingLineNumber);
      
    }
    return;
  }


  s_UseTool TextDrawing;
  TextDrawing.Clear();//Not necessary but good practice
  TextDrawing.ChartNumber = sc.ChartNumber;
  TextDrawing.DrawingType = DRAWING_STATIONARY_TEXT;

  if (TextDrawingLineNumber != 0)
    TextDrawing.LineNumber = TextDrawingLineNumber;

  TextDrawing.AddAsUserDrawnDrawing = 1;
  TextDrawing.UseRelativeVerticalValues = 1;
  TextDrawing.BeginDateTime = 50;
  TextDrawing.BeginValue = 50;
  TextDrawing.Color = COLOR_KHAKI;
  TextDrawing.Text = "Stationary 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;


}

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: 2017-11-03 02:10:50
[2017-11-06 17:25:51]
cross - Posts: 70
The idea is to put on a label and hide/show when the trade management is off/on. Stationary text seems to be the right tool.

Besides using a persistent integer for the LineNumber.. I retrieve the text label by:
sc.GetUserDrawingByLineNumber(sc.ChartNumber, TextDrawingLineNumber, TextDrawing)

If the result is false I do what you sent too (UTAM_ADD_ONLY_IF_NEW).

However, if the label aready exists and I just flip the HideDrawing as you see below and vice versa..
    if (TextDrawing.HideDrawing == 0)
    {
      TextDrawing.HideDrawing = 1;
      sc.UseTool(TextDrawing);
      TextDrawingLineNumber = TextDrawing.LineNumber;
}

.. the text begins drifting.

May the GetUserDrawingByLineNumber(...) not retrieve all the label members correctly and so the hiding/showing sc.UseTool() resets some fields? Or do I need to re-set some members to properly display the label again after changing the HideDrawing?

Thanks
[2017-11-06 23:53:46]
Sierra Chart Engineering - Posts: 104368
May the GetUserDrawingByLineNumber(...) not retrieve all the label members correctly and so the hiding/showing sc.UseTool() resets some fields?
Yes, this must be the problem and we are making some changes and additions to solve this. This will be out in the next release.
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
[2020-11-05 15:55:51]
ycomp - Posts: 277
hello, quick question... does

s_UseTool TextDrawing;

instantiate the object?

and does it need to be freed explicitly or it will just handle that automatically?
[2020-11-05 16:50:23]
cross - Posts: 70
It is an instance. You need to use tool.DrawingType member to set what type of tool it represents.
And sc.UseTool(tool) to make it visible or update it on the screen.
No need to free it up since it exists in the { } scope only.
See Persistent Variable part of the Documentation to keep data between Study update/iteration.
Date Time Of Last Edit: 2020-11-05 16:52:10

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

Login

Login Page - Create Account