Login Page - Create Account

Support Board


Date/Time: Wed, 19 Mar 2025 14:10:36 +0000



When I adjust user drawn drawing with UseTool, it changes the drawing appearance

View Count: 609

[2021-11-18 11:21:20]
tomna1993 - Posts: 24
I ran into a problem with UseTool. I draw retracement on chart with UseTool and when I modify the BeginIndex, EndIndex, BeginValue or EndValue it changes one of the grid level (-33%) appearance. That grid level will change its thickness to 25 from 1 (see attached picture).

Here is the code with I draw and modify the drawing:
int DrawEntryGrid(SCStudyInterfaceRef sc, int EntryGridLineNumber, float EntryGridBeginValue, float EntryGridEndValue, int EntryGridBeginIndex, int EntryGridEndIndex)
{
s_UseTool Grid;
Grid.Clear();
Grid.ChartNumber = sc.ChartNumber;
Grid.Region = sc.GraphRegion;

if(EntryGridLineNumber != 0)
Grid.LineNumber = EntryGridLineNumber;

Grid.AddAsUserDrawnDrawing = 1;

Grid.AddMethod = UTAM_ADD_OR_ADJUST;

Grid.DrawingType = DRAWING_RETRACEMENT;
Grid.UseToolConfigNum = 10;

Grid.BeginIndex = EntryGridBeginIndex;
Grid.BeginValue = EntryGridBeginValue;
Grid.EndIndex = EntryGridEndIndex;
Grid.EndValue = EntryGridEndValue;

sc.UseTool(Grid);

return Grid.LineNumber;
}

I save the LineNumber in persistent variable after returning to be able to modify the drawing.
imagefirst_drawing.png / V - Attached On 2021-11-18 11:20:50 UTC - Size: 21.7 KB - 151 views
imagemodified_drawing.png / V - Attached On 2021-11-18 11:20:57 UTC - Size: 18.52 KB - 154 views
[2021-11-19 17:50:21]
Sierra_Chart Engineering - Posts: 18841
We will test 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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-11-19 20:53:07]
Sierra_Chart Engineering - Posts: 18841
We definitely cannot reproduce any problem.
Remove this:
Grid.UseToolConfigNum = 10;

This is our test code:
  int& r_LineNumber = sc.GetPersistentInt(1);

  if (sc.IsFullRecalculation)
  {
    s_UseTool Tool;
    //Tool.Clear();
    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_RETRACEMENT;
    Tool.ExtendLeft = 1;// Extend the horizontal retracement lines to the left of the chart region.
    
    if (r_LineNumber != 0)
      Tool.LineNumber = r_LineNumber;

    int BarIndex = sc.ArraySize - 100;// 100 bars back and from high to low
    BarIndex = max(BarIndex, 0);
    Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
    Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize - 1];
    Tool.BeginValue = sc.High[sc.ArraySize - 1];
    Tool.EndValue = sc.Low[BarIndex];
    Tool.Color = RGB(255, 0, 255); // Magenta
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;

    for (int LevelIndex = 0; LevelIndex < 16; LevelIndex++)
      Tool.RetracementLevels[LevelIndex] = LevelIndex * 10.0f;

    Tool.ShowPrice = 1;
    Tool.ShowPercent = 1;
    Tool.RoundToTickSize = 0;
    Tool.TextAlignment = DT_VCENTER; // label vertical alignment
    Tool.AddAsUserDrawnDrawing = 1;

    sc.UseTool(Tool);
    r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set

  }
  else if (sc.UpdateStartIndex < sc.ArraySize - 1)
  {
    // Update the drawing
    s_UseTool Tool;
    Tool.RetracementLevels[10] = FLT_MAX;//remove the 11th level

    int BarIndex = sc.ArraySize - 100;// 100 bars back and from high to low
    BarIndex = max(BarIndex, 0);
    Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
    Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize - 1];

    Tool.ChartNumber = sc.ChartNumber;
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    Tool.LineNumber = r_LineNumber;

    //Tool.UseToolConfigNum = 2;
    Tool.AddAsUserDrawnDrawing = 1;

    sc.UseTool(Tool);

  }

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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-10-19 14:00:26]
tomna1993 - Posts: 24
Still not working correctly, see the GIF. The linewidth modified just for the first level, if I turn it off then the problem disappears.
Date Time Of Last Edit: 2022-10-19 14:02:31
imagegrid problem.gif / V - Attached On 2022-10-19 14:00:13 UTC - Size: 4.61 MB - 101 views

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

Login

Login Page - Create Account