Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 18:46:25 +0000



Delete user drawings in "LastCallToFunction"

View Count: 1343

[2017-05-17 13:21:46]
T29_Dev1 - Posts: 22
I have a study to draw some graphic elements as user drawn drawings. Study deletes that drawings in "LastCallToFunction" section.

Deleting works fine when I remove the study from chart. But when I do:
1. close chartbook (save all - yes)
2. re-open the chartbook

I can see drawings from previous session.

I attached a simple study to show the issue. If you add this study to a chart and open/close chartbook a couple times, you will see many instances of text.


SCSFExport scsf_delete_user_drawing(SCStudyGraphRef sc)
{
  int &ln = sc.PersistVars->i1;

  if (sc.SetDefaults)
  {
    sc.GraphName = "Delete User Drawing Test";
    sc.FreeDLL = 1;
    sc.AutoLoop = 1;
    sc.GraphRegion = 0;
    return;
  }

  if(sc.Index == 0)
  {
    if(ln == 0)
    {
      s_UseTool tool;
      tool.AddAsUserDrawnDrawing = 1;
      tool.ChartNumber = sc.ChartNumber;
      tool.DrawingType = DRAWING_TEXT;
      tool.Region = sc.GraphRegion;
      tool.Color = COLOR_RED;
      tool.FontSize = 13;
      tool.TextAlignment = DT_TOP | DT_LEFT;
      tool.UseRelativeVerticalValues = 1;
      tool.BeginDateTime = 2;
      tool.BeginValue = 98.0f;
      tool.Text = SCString().Format("I'm Text - %f", (float)sc.LatestDateTimeForLastBar);
      tool.AddMethod = UTAM_ADD_OR_ADJUST;
      sc.UseTool(tool);
      ln = tool.LineNumber;
    }
  }

  if(sc.LastCallToFunction)
  {
    if(ln != 0)
      sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, ln);
  }
}

[2017-05-18 06:06:38]
Sierra Chart Engineering - Posts: 104368
You need to save this structure variable to 0 to prevent the drawings from being saved:
https://www.sierrachart.com/index.php?page=doc/ACSILDrawingTools.html#AllowSaveToChartbook
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

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

Login

Login Page - Create Account