Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 13:32:20 +0000



GetACSDrawingByLineNumber not working?

View Count: 1367

[2017-10-09 20:39:09]
User436155 - Posts: 16
hi there,

i am confused with following problem. after creating line (with AddAsUserDrawnDrawing = 1 and AddMethod = UTAM_ADD_OR_ADJUST) i remember line number (which is negative) as a persistnent number. line is working as expected. i can select it and move it freely.

then i want to modify it (change color). UserDrawnChartDrawingExists() call returns true. but GetACSDrawingByLineNumber call (with correct line number) returns 0 - as failed. so i can not modify the line in ACS mode.

somehow GetUserDrawingByLineNumber call will return 1 and then i can modify color of line. but GetUserDrawingByLineNumber call will lock the line and it can not be selected nor moved as user line again (although i set AddAsUserDrawnDrawing = 1 and AddMethod = UTAM_ADD_OR_ADJUST).

maybe my code is not correct. but i do not know the reason why i can not select the line with GetACSDrawingByLineNumber call.

can you please help me? thank you in advance !
Jan
[2017-10-10 17:41:40]
Sierra Chart Engineering - Posts: 104368
Refer to the documentation for sc.GetACSDrawingByLineNumber. That function is not for user drawn drawings. You need to use sc.GetUserDrawingByLineNumber instead.

Refer to:
http://www.sierrachart.com/index.php?page=doc/ACSILDrawingTools.html

but GetUserDrawingByLineNumber call will lock the line and it can not be selected nor moved as user line again
This is a complete impossibility. There must be something else you are doing to create this problem and we do not know what.
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-10-10 18:31:38]
User436155 - Posts: 16
ok i create a horizontal line with attributes:
drawing_tool.AddAsUserDrawnDrawing = 1 ;
drawing_tool.AddMethod = UTAM_ADD_OR_ADJUST ;

after creating a line i can select it and move it to another price value on the chart.
then i want to change its color.

i select it with: sc.GetUserDrawingByLineNumber call
set a color with: drawing_tool.Color = RGB(200,200,255);
and applying the change with call: sc.UseTool( drawing_tool ) ;
(adding drawing_tool.AddAsUserDrawnDrawing = 1 ; drawing_tool.AddMethod = UTAM_ADD_OR_ADJUST ; does not change the result)

after those calls line has new color. but i can NOT select it and move it anymore.

what is wrong? how can i change color (or another attribute of line) without 'locking' the line? please help me. there is NO example about this. thank you very much !
[2017-10-10 20:14:48]
User436155 - Posts: 16
i think i get the concept wrong.

for every change of graphic object it is necessary to redeclare it anew with all attributes of old object gotten with sc.GetUserDrawingByLineNumber call and adding new modified attributes. which causes redraw of graphic object.

and sc.GetUserDrawingByLineNumber call is only for getting attributes of object but not for changing them.

is this statement correct?
thank you !
[2017-10-11 08:55:28]
Sierra Chart Engineering - Posts: 104368
No, this is not correct in regards to post #4. There apparently is a problem we need to look into. Just give us about a day for 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-10-11 09:09:37]
User436155 - Posts: 16
ok, thank you very much. because that was the only way how i could keep the line accessible/movable with changed color attribute or another attribute like HideDrawing.
[2017-10-11 09:47:33]
Sierra Chart Engineering - Posts: 104368
We have fixed the problem and this will be out in the next release in a day or two.

But this is an example of how to add a user drawn drawing and modify it:

SCSFExport scsf_UseToolExampleHorizontalLine(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Horizontal Line";
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0; //No automatic looping

    return;
  }


  int &r_LineNumber = sc.GetPersistentInt(1);
  if (sc.IsFullRecalculation)
  {

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

    //Draw horizontal line during full recalculation.
    s_UseTool Tool;
    Tool.Clear();
    Tool.ChartNumber = sc.ChartNumber;

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

    Tool.DrawingType = DRAWING_HORIZONTALLINE;
    Tool.DisplayHorizontalLineValue = 1;

    int DrawingIndex = sc.ArraySize - 4;
    Tool.BeginValue = sc.Close[sc.ArraySize - 1];
    Tool.Region = 0;
    Tool.Color = RGB(255, 0, 255); // Magenta
    Tool.LineWidth = 4;
    Tool.AddMethod = UTAM_ADD_ALWAYS;
    Tool.AddAsUserDrawnDrawing = 1;
    sc.UseTool(Tool);
    r_LineNumber = Tool.LineNumber;
  }
  else if (sc.UpdateStartIndex < sc.ArraySize - 1)//When there is a new bar
  {
    //Now move the drawing to the current closing price when a new bar has been added to the chart
    s_UseTool Tool;

    ///No need for this
    //sc.GetUserDrawingByLineNumber(sc.ChartNumber, LineNumber, Tool);

    Tool.Clear();
    Tool.ChartNumber = sc.ChartNumber;
    Tool.BeginValue = sc.Close[sc.ArraySize - 1];
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    Tool.LineNumber = r_LineNumber;
    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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-10-11 09:47:59
[2017-10-11 11:27:33]
User436155 - Posts: 16
thank you very much!

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

Login

Login Page - Create Account