Support Board
Date/Time: Mon, 10 Mar 2025 20:20:34 +0000
Post From: ACSIL Updating Ray issue in recent SC versions
[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); } } } |