Login Page - Create Account

Support Board


Date/Time: Sat, 28 Dec 2024 09:38:51 +0000



ACSIL Tool drawing; DRAWING_LINE extendright and extendleft

View Count: 1622

[2016-02-16 02:01:44]
@sstfrederik - Posts: 404
Hi,
I want to plot a line with sc.UseTool and extend it to the right. I found out that this can be done only when there is a second call to the sc.UseTool function. The first call will not have extended lines the second call does. The code below will demonstrate that. Ideally I would like to call sc.Usetool as less often a possible. Is it on purpose that a first call will not draw the extended line? I will be happy to use it as is, but was curious if it can be optimized.

Thanks
Frederik


SCSFExport scsf_Debug(SCStudyInterfaceRef sc)
{
  
  SCInputRef ExtendRight = sc.Input[0];
  SCInputRef Counter = sc.Input[1];
  
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "debug";
    sc.GraphRegion = 0;
    
    sc.StudyDescription = "we debug and test";
    
    sc.AutoLoop = 0;
    
    // During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance.
    sc.FreeDLL = 1;
    
    ExtendRight.Name = "Extend lines to the right";
    ExtendRight.SetYesNo(1);
    ExtendRight.SetDescription("extend to right");
    
    Counter.Name = "counter";
    Counter.SetInt(1);
    Counter.SetDescription("counter");
    
    return;
  }
  
  if(sc.UpdateStartIndex == 0){
    int& counter = sc.PersistVars->i1;
    counter = 0;
  }
  
//main loop with manual looping
  for (int index = sc.UpdateStartIndex; index < sc.ArraySize; index++ ){
    int& counter = sc.PersistVars->i1;
    if(sc.UpdateStartIndex != 0 && counter < Counter.GetInt()){
      int& counter = sc.PersistVars->i1;
      s_UseTool Tool;
      Tool.Clear(); // reset tool structure for our next use
      Tool.ChartNumber = sc.ChartNumber;
      Tool.DrawingType = DRAWING_LINE;
      Tool.ExtendRight= ExtendRight.GetYesNo();
      Tool.ExtendLeft = 1;
      Tool.LineNumber = 123451;
      Tool.BeginDateTime = sc.BaseDateTimeIn[sc.ArraySize - 40];
      Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize + 1];
      Tool.BeginValue = sc.High[sc.Index];
      Tool.EndValue = sc.High[sc.Index];
      Tool.Color = RGB(0, 0, 255);
      sc.UseTool(Tool);
      counter +=1;
      SCString MessageString;
      MessageString.Format("counter = %d", counter);
      sc.AddMessageToLog(MessageString,1);
    }
  }  
}

[2016-02-16 03:16:26]
Sierra Chart Engineering - Posts: 104368
The proper drawing type to use in this case is DRAWING_RAY.


This will do what you want from the first call.
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
[2016-02-16 21:45:28]
@sstfrederik - Posts: 404
When I use DRAWING_RAY and set ExtendRight to false it will still extend to the right. For my use I want to use the ExtendRight as an option. If its fasle than the Tool.EndDateTime is used.
Any other suggestions? Thanks.
Date Time Of Last Edit: 2016-02-16 21:48:11
[2016-02-16 21:58:42]
Sierra Chart Engineering - Posts: 104368
In the cases where you do not want to extend the line to the right or left, then use DRAWING_LINE.
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: 2016-02-16 21:58:57
[2016-02-16 22:21:22]
@sstfrederik - Posts: 404
That's what I will do. Thanks.

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

Login

Login Page - Create Account