Login Page - Create Account

Support Board


Date/Time: Thu, 13 Feb 2025 16:36:35 +0000



ACSIL issue with writing drawings to remote chart

View Count: 1034

[2020-12-11 18:18:09]
onnb - Posts: 662
We are having an issue with drawing rectangles on remote charts.
I've created a sample script to reproduce the issue and it is easily reproduceable (attached).

Steps to reproduce using the study TestRects:
1. Open two charts side by side
2. Add the study to chart #1
3. In the study settings, set the remote number to 2
4. Select chart #1, open the replay control and run a replay with All Charts in Chartbook

Expected: rectangle to be drawn to chart #2
Actual: rectangle is drawn on chart #1

I think this might happen in other scenarios, but this one is the easiest for me to reproduce.

I also recorded a 1min video - http://www.youtube.com/watch?v=nBu6t-cvqdM


Hope this makes sense.
imageTestRects-Issue.png / V - Attached On 2020-12-11 18:03:44 UTC - Size: 155.68 KB - 280 views
attachmentTestRects.cpp - Attached On 2020-12-11 18:15:26 UTC - Size: 1.93 KB - 357 views
[2020-12-12 22:36:31]
Sierra Chart Engineering - Posts: 104368
We have tested this, and we cannot see any problem. Here is a function which you can use for testing. We also did a test using chart replay. Still no problem.

SCSFExport scsf_UseToolExampleRectangleHighlight(SCStudyInterfaceRef sc)
{
  // Draw a rectangle highlight

  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Rectangle Highlight";
    sc.GraphRegion = 0;
    
    sc.AutoLoop = 0; //No automatic looping

    return;
  }

  if (sc.LastCallToFunction)
    return;

  // Do data processing  
  int BarIndex = 0;

  int& r_LineNumber = sc.GetPersistentInt(1);

  s_UseTool Tool;

  //Tool.ChartNumber = sc.ChartNumber;
  Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT;  

  if (r_LineNumber != 0)
    Tool.LineNumber = r_LineNumber;

  // Update BarIndex to 30 bars from the end
  BarIndex = max(sc.ArraySize - 25, 0);
  Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
  BarIndex = max(sc.ArraySize - 15, 0);
  Tool.EndDateTime = sc.BaseDateTimeIn[BarIndex];
  Tool.BeginValue = sc.GetHighest(sc.Low, BarIndex, 10);
  Tool.EndValue = sc.GetLowest(sc.Low, BarIndex, 10);
  Tool.Color = RGB(255, 0, 0); // Red
  Tool.LineWidth = 1; //To see the outline this must be 1 or greater.
  Tool.SecondaryColor = RGB(0, 255, 0);
  Tool.TransparencyLevel = 50;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;

  // Add rectangle drawing to chart number 2.
  Tool.AddAsUserDrawnDrawing = 1;
  Tool.ChartNumber = 2;

  sc.UseTool(Tool);

  r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set
}

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: 2020-12-12 23:02:29
[2020-12-14 18:02:22]
onnb - Posts: 662
Thanks for taking a look - I tested your script and it works fine.
I checked for the differences and looks like the issue comes up with AutoLoop = 1;

I modified your script slightly to support AutoLooping and tested
Pasting here for your reference. Using this I can reproduce it on 2204.


SCSFExport scsf_UseToolExampleRectangleHighlight(SCStudyInterfaceRef sc)
{
  SCInputRef in_remote_chart = sc.Input[0];
  // Draw a rectangle highlight

  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Rectangle Highlight AutoLoop";
    sc.GraphRegion = 0;

    sc.AutoLoop = 1; //No automatic looping

    in_remote_chart.Name = "Remote Chart Number";
    in_remote_chart.SetInt(0);

    return;
  }

  if (sc.LastCallToFunction)
    return;

  int& r_LineNumber = sc.GetPersistentInt(1);
  int& r_ChartNumber = sc.GetPersistentInt(2);

  if (sc.Index == 0)
  {
    if (r_LineNumber != 0)
    {
      sc.DeleteUserDrawnACSDrawing(r_ChartNumber, r_LineNumber);
      r_LineNumber = 0;
    }
  }

  if (sc.Index < sc.ArraySize - 3)
    return;

  // Do data processing
  int BarIndex = 0;

  s_UseTool Tool;

  //Tool.ChartNumber = sc.ChartNumber;
  Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT;

  if (r_LineNumber != 0)
    Tool.LineNumber = r_LineNumber;

  // Update BarIndex to 30 bars from the end
  BarIndex = max(sc.ArraySize - 25, 0);
  Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
  BarIndex = max(sc.ArraySize - 15, 0);
  Tool.EndDateTime = sc.BaseDateTimeIn[BarIndex];
  Tool.BeginValue = sc.GetHighest(sc.Low, BarIndex, 10);
  Tool.EndValue = sc.GetLowest(sc.Low, BarIndex, 10);
  Tool.Color = RGB(255, 0, 0); // Red
  Tool.LineWidth = 1; //To see the outline this must be 1 or greater.
  Tool.SecondaryColor = RGB(0, 255, 0);
  Tool.TransparencyLevel = 50;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;

  // Add rectangle drawing to chart number 2.
  Tool.AddAsUserDrawnDrawing = 1;
  Tool.ChartNumber = in_remote_chart.GetInt();
  r_ChartNumber = Tool.ChartNumber;

  sc.UseTool(Tool);

  r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set
}



[2020-12-15 02:31:42]
Sierra Chart Engineering - Posts: 104368
We have had a look at this.

We have added this to the documentation:
In the case of a user drawn drawing (s_UseTool::AddAsUserDrawnDrawing=1), adding a new Chart Drawing, and specifying a negative line number other than -1, will result in sc.UseTool returning 0 and the drawing will not be added.

And we have added this to the documentation which will go into effect in the next release:
If the ChartNumber specified is not in the Chartbook or that chart is in the process of loading chart data (not downloading historical data), then the Chart Drawing will not be added by the sc.UseTool function.

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