Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 17:27:23 +0000



ACSIL Updating Ray issue in recent SC versions

View Count: 1247

[2022-03-02 21:01:22]
onnb - Posts: 662
The code below is working in version 2331 and is not working in 2362.
The code draws a Ray and then using mouse clicks the drawing is modified.
There is an issue with the modifications.


How to test it:
1. Add the study to the chart - you will see a Ray drawing on the right hand side
2. Click somewhere on the chart

2331 - the Ray is updated to the new mouse click x,y position
2362 - the Ray price is updated correctly but the bar index does not update


#include "sierrachart.h"

SCDLLName("Update Issue")

int CreateRay(SCStudyGraphRef sc, int i1, float p1, int i2, float p2)
{
  s_UseTool tool;
  tool.ChartNumber = sc.ChartNumber;
  tool.DrawingType = DRAWING_RAY;
  tool.Region = sc.GraphRegion;
  tool.AddMethod = UTAM_ADD_OR_ADJUST;
  tool.TextAlignment = DT_RIGHT;
  tool.BeginValue = p1;
  tool.BeginIndex = i1;
  tool.EndValue = p2;
  tool.EndIndex = i2;
  tool.Color = COLOR_GREEN;
  tool.LineWidth = 2;
  tool.LineStyle = LINESTYLE_SOLID;
  tool.AddAsUserDrawnDrawing = 1;
  sc.UseTool(tool);

  return tool.LineNumber;
}

SCSFExport scsf_update_issue(SCStudyInterfaceRef sc)
{
  int& line_num  = sc.GetPersistentIntFast(1);
  int& index1    = sc.GetPersistentIntFast(2);

  if (sc.SetDefaults)
  {
    sc.GraphName = "Update Issue";
    sc.StudyDescription = "";
    sc.AutoLoop = 0;
    sc.GraphRegion = 0;
    sc.ReceivePointerEvents = ACS_RECEIVE_POINTER_EVENTS_ALWAYS;

    return;
  }

  if (sc.UpdateStartIndex == 0)
  {
    if (line_num == 0)
    {
      index1 = sc.ArraySize - 10;
      line_num = CreateRay(sc, index1, sc.Close[sc.ArraySize-2], index1 + 3, sc.Close[sc.ArraySize - 2]);
    }
    return;
  }

  if (sc.PointerEventType == SC_POINTER_BUTTON_DOWN)
  {
    s_UseTool chart_drawing;
    if (sc.GetUserDrawnDrawingByLineNumber(sc.ChartNumber, line_num, chart_drawing))
    {
      chart_drawing.BeginIndex = sc.ActiveToolIndex;
      chart_drawing.BeginValue = sc.ActiveToolYValue;
      chart_drawing.EndIndex = sc.ActiveToolIndex + 1;
      chart_drawing.EndValue = sc.ActiveToolYValue;
      sc.UseTool(chart_drawing);
    }
  }
}


[2022-03-03 22:56:42]
Sierra Chart Engineering - Posts: 104368
We will look into this as soon as we can.
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
[2022-04-05 22:21:49]
Sierra_Chart Engineering - Posts: 18732
Modify the following code:

if (sc.GetUserDrawnDrawingByLineNumber(sc.ChartNumber, line_num, chart_drawing))
{
chart_drawing.BeginIndex = sc.ActiveToolIndex;
chart_drawing.BeginValue = sc.ActiveToolYValue;
chart_drawing.EndIndex = sc.ActiveToolIndex + 1;
chart_drawing.EndValue = sc.ActiveToolYValue;
sc.UseTool(chart_drawing);
As follows:
    if (sc.GetUserDrawnDrawingByLineNumber(sc.ChartNumber, line_num, chart_drawing))
    {
      chart_drawing.BeginDateTime.Clear();
      chart_drawing.EndDateTime.Clear();

      chart_drawing.BeginIndex = sc.ActiveToolIndex;
      chart_drawing.BeginValue = sc.ActiveToolYValue;
      chart_drawing.EndIndex = sc.ActiveToolIndex + 1;
      chart_drawing.EndValue = sc.ActiveToolYValue;
      sc.UseTool(chart_drawing);
    }

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

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

Login

Login Page - Create Account