Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 02:09:23 +0000



[Programming Help] - bar index of ACSIL created drawing

View Count: 3260

[2015-07-08 19:03:32]
User231363 - Posts: 31
I am creating rays from ACSIL at various bars and price levels.
I would like to have the study delete the rays that are older than a certain bar index, however I can't figure out how to get this information from existing ray drawings.
I have tried GetUserDrawnChartDrawing(), and while it returns the correct Line Number, the .BeginIndex is -1 even though I can see the ray on the chart at the correct bar index.

How can I get the bar index number from an existing drawing?

thanks.
[2015-07-09 18:33:54]
Sierra Chart Engineering - Posts: 104368
Use this ACSIL array:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html#scBaseDateTimeIn

to determine a particular Date-Time for that bar index and simply compare that to the Date-Time values of the chart drawing.

There are also functions to get a bar index using a date-time value. Refer to:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html
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
[2015-07-09 19:42:50]
User231363 - Posts: 31
I know how to work the indexes. The issue is that when I read the ray drawings created by ACSIL, the BlockTradeLine.BeginIndex and BlockTradeLine.BeginDateTime are -1.

I'm using this code to create the rays:
    
      LastBlockTradeLineBarIndex = sc.Index;
          LastBlockTradeLinePrice = currPrice;
          Tool.Clear(); // reset tool structure for our next use
          Tool.AddAsUserDrawnDrawing = 1;
          Tool.ChartNumber = ChartNumberToDrawLines.GetInt();
          Tool.DrawingType = DRAWING_HORIZONTAL_RAY;
          //Tool.DisplayHorizontalLineValue = 1;
          Tool.LineNumber = LastBlockTradeLineNumUsed;
          Tool.BeginIndex = sc.Index;
          Tool.BeginValue = currPrice;// *sc.RealTimePriceMultiplier;
          //Tool.EndValue = Tool.BeginValue;
          Tool.Color = RGB(255, 0, 255); // Magenta
          //Tool.Text = "bid";
          Tool.LineStyle = LINESTYLE_DOT;
          //Tool.LineWidth = 3;
          Tool.AddMethod = UTAM_ADD_OR_ADJUST;
          sc.UseTool(Tool);
          SCString Buffer;
          Buffer.Format("Created line chart: %d w/line num: %d @ index:%d price:%f", Tool.ChartNumber, Tool.LineNumber, Tool.BeginIndex, Tool.BeginValue);
          sc.AddMessageToLog(Buffer, 0);

=======================================
Code to read the drawing:

      int chartsFound = sc.UserDrawnChartDrawingExists(targetChartNum, i);
      if (chartsFound > 0)
      {
        BlockTradeLine.Clear();
        sc.GetUserDrawnChartDrawing(targetChartNum, DRAWING_RAY, BlockTradeLine, 0);
        SCDateTime lineTime = BlockTradeLine.BeginDateTime;
        SCString timeStr = sc.FormatDateTime(lineTime).GetChars();
        Buffer.Format(" deleting chart: %d w/line num: %d -> index: %d, price:%f, date:%s", targetChartNum, i, BlockTradeLine.BeginIndex, BlockTradeLine.BeginValue, timeStr);
        sc.AddMessageToLog(Buffer, 0);


===================================
[2015-07-10 03:31:21]
Sierra Chart Engineering - Posts: 104368
the BlockTradeLine.BeginIndex and BlockTradeLine.BeginDateTime are -1.

This is an indication that you are not successfully getting the drawing.

We have confirmed that both of those variables are set when getting the 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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-07-10 03:31:52
[2018-07-15 10:40:06]
binaryduke - Posts: 359
We have confirmed that both of those variables are set when getting the drawing.

Please could you provide an example of this that successfully returns BeginIndex or BeginDateTime? Testing with the code below still returns a -1 value for the BeginIndex member of the s_UseTool structure yet the BeginValue member of the structure is populated upon the creation of the drawing. I have noted the documentation comment for sc.GetACSDrawingByIndex() that:


When a Chart Drawing you are getting is not visible in the current view of the chart, then s_UseTool::BeginIndex, s_UseTool::EndIndex, s_UseTool::ThirdIndex will all equal -1 unless the drawing specified its horizontal positioning using these *Index values when it was added.

and in testing the code below specified the horizontal positioning using these Index values. I have further tested by specifying s_UseTool::EndIndex and s_UseTool::ThirdIndex with the same result.


//create a drawing
s_UseTool MyDrawing;
MyDrawing.Clear();
MyDrawing.ChartNumber = sc.ChartNumber;
MyDrawing.DrawingType = DRAWING_MARKER;
MyDrawing.MarkerType = MARKER_POINT;
MyDrawing.MarkerSize = 10;
MyDrawing.Color = RGB(255,0,0);
MyDrawing.AddMethod = UTAM_ADD_OR_ADJUST;
MyDrawing.BeginIndex = sc.Index;
MyDrawing.BeginValue = sc.High[sc.Index];
sc.UseTool(MyDrawing);

//access the created drawing to obtain the value of its s_UseTool structure members
s_UseTool ExistingDrawing;
for (int i = 0; i < sc.GetACSDrawingsCount(0, 1); i++)
{
ExistingDrawing.Clear();
int Result = sc.GetACSDrawingByIndex(0, i, ExistingDrawing, 1);
SCString ExistingDrawingInfo;
ExistingDrawingInfo.Format("Drawing Index %i GetACSDrawingResult %i BeginIndex %i BeginValue %f", i, Result, ExistingDrawing.BeginIndex, ExistingDrawing.BeginValue);
sc.AddMessageToLog(ExistingDrawingInfo, 0);
}

[2018-07-17 19:09:40]
Sierra Chart Engineering - Posts: 104368
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-07-17 19:50:58]
Sierra Chart Engineering - Posts: 104368
There is a problem related to this and it will be resolved in 1783.
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: 2018-07-17 19:51:07
[2019-10-09 22:23:50]
lhealey - Posts: 5
[quote]How to Capture the Bar Index (date) of a User Drawn Vertical Line[/quote]

I need to capture the date that corresponds to a manually drawn Vertical Line; a line NOT created by ACSIL.

I use [b]a single vertical line[/b] to mark the new Earnings Date for each symbol I'm evaluating.

These earnings dates vary greatly, but it's an integral part of my analysis.

Seems like it should be simple, but I can't seem to find an answer.

The latest function I've tried is sc.GetUserDrawnChartDrawing()... but this seems only useful for capturing text.

I notice the Anchor text displays the date, so I could use that data or the actual date, the bar index or even another drawing tool if need be.

Thanks!!!

http://www.sierrachart.com/image.php?Image=1570659557876.png

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

Login

Login Page - Create Account