Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 08:23:19 +0000



Prevent UserDrawnDrawings to be copied when chart is duplicated

View Count: 455

[2021-07-28 20:19:56]
@sstfrederik - Posts: 403
Hi,

Is there some way to prevent a drawing that is drawn from a study to not be replicated when a chart is duplicated?

The thing is that the UserDrawnDrawing that originated from the study will be present twice in the new chart, one from the duplication and another one from the study load itself.

Thanks.

Frederik
[2021-07-29 14:31:19]
John - SC Support - Posts: 31098
Refer to the following:
Using Drawing Tools From an Advanced Custom Study: s_UseTool::AllowCopyToOtherCharts
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-29 16:20:39]
@sstfrederik - Posts: 403
Hi John,

That is not what I meant. The Tool.AllowCopyToOtherCharts = 0; is the default, is a different functionality, and this does not prevent a drawing to be duplicated when a chart is duplicated.

When example study is loaded on a chart. And this chart is subsequently duplicated, you will see two rectangle highlight drawings are being drawn on that new chart. One is from the duplication and another one from the study calculation.

Would be great if this can be prevented and only the one from the study to be drawn.

Thanks for your time.

Frederik

Example code:

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;
  }

  int& r_LineNumber = sc.GetPersistentInt(1);
  
  if (sc.LastCallToFunction){
    
    
    if (sc.UserDrawnChartDrawingExists(sc.ChartNumber,r_LineNumber) > 0){
      
      sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, r_LineNumber);
    }
    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;
  Tool.AllowSaveToChartbook = 0;
  Tool.AddAsUserDrawnDrawing = 1;
  Tool.AllowCopyToOtherCharts = 0;
  
  sc.UseTool(Tool);

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

[2021-07-29 16:41:24]
John - SC Support - Posts: 31098
Sorry, you are correct. We were not thinking of the duplicate chart functionality.

The option available is to not make the drawing a User Drawn Drawing. Otherwise, you would have to check for the existence of the drawing an then not draw it again.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-29 18:00:49]
@sstfrederik - Posts: 403
What you suggest will not work. There is no way to distinguish between a user added drawing and a User Drawn Drawing made by a study, there is no way to distinguish by which study a drawing was made, making the check impossible. The simplest is to exclude duplicating User Drawn Drawings made by a study when a chart is duplicated.
[2021-07-29 18:33:40]
John - SC Support - Posts: 31098
We will add the suggestion to our list of work items.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-30 20:10:08]
Sierra Chart Engineering - Posts: 104368
We will implement a solution to this including being able to determine if a Chart Drawing was added by a custom study.
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
[2021-08-01 01:18:24]
Sierra Chart Engineering - Posts: 104368
This has been released. Update to the latest prerelease.
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