Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 17:09:39 +0000



[Programming Help] - AddAsUserDrawnDrawing AND LineNumber behaviour

View Count: 784

[2016-11-13 20:14:57]
kas64h - Posts: 87
I seem to have several issues when using ACSIL to draw multiple user drawn drawings (AddAsUserDrawnDrawing set to 1), which are probably best explained using your scsf_UseToolExampleMultipleDrawingsSameIndex example code in the studies.cpp file.


********** ISSUE 1 - Attempting to add a 2nd drawing with Tool.AddAsUserDrawnDrawing = 1 under different LineNumbers **********

Using the scsf_UseToolExampleMultipleDrawingsSameIndex example code, I add the line Tool.AddAsUserDrawnDrawing = 1; immediately above the existing line Tool.DrawingType = DRAWING_MARKER;

This code still runs fine and produces 2 'user drawn' markers, but in accordance with your documentation there is a potential issue.

As AddAsUserDrawnDrawing is set to 1, drawings with negative LineNumbers will be produced.
However, in order to 'force' the automatic assignment of a LineNumber when drawing non-user drawn drawings your code sets the LineNumber to -1 (Tool.LineNumber = -1;)
Furthermore, under the LineNumber documentation, it explicitly states: "Do not use a negative LineNumber when s_UseTool::AddAsUserDrawnDrawing is set to a nonzero number because a negative number may conflict with other user drawn Chart Drawings added by ACSIL and also through the Sierra Chart user interface."

Considering the above, I commented out the Tool.LineNumber = -1; line of code (along with the else; statement preceding it)

However, if I now run the code, only he first drawing gets drawn, and not the second.
Interestingly, if I replace Tool.AddMethod = UTAM_ADD_OR_ADJUST; with Tool.AddMethod = UTAM_ADD_ALWAYS; then the second drawing gets drawn, and not the first.

I have found 3 ways to code around it, but am unclear if any are recommended, or whether any kind of bug fix is required?

Method 1) Simply re-introduce Tool.LineNumber = -1; and accept the potential negative number conflict

Method 2) Replace Tool.LineNumber = -1; with either Tool.LineNumber = 0; or Tool.LineNumber = 1; I'm assuming this is recognized as an illegal LineNumber when Tool.AddAsUserDrawnDrawing is set to 1, and so an automatic negative LineNumber is generated?

Method 3) Comment out the Tool.LineNumber = -1; line of code (along with the else; statement preceding it), clear the Tool (i.e. Tool.Clear()), and re-assign all values back to the Tool (except LineNumber which is left unset).

All 3 methods work. I don't know if any are favourable or whether a bug fix is required?
From the documentation, I'd expected to have to leave Tool.LineNumber completely unset.


********** ISSUE 2 - Attempting to add a 2nd drawing with Tool.AddAsUserDrawnDrawing = 1 using the SAME LineNumber **********

Again using the original scsf_UseToolExampleMultipleDrawingsSameIndex example code, if I try to add two user drawn drawings under the SAME LineNumber, then only the first drawing ever gets drawn, and not the second.

So I add/alter the following code:

1) Add the code Tool.AddAsUserDrawnDrawing = 1; immediately above the existing Tool.DrawingType = DRAWING_MARKER; line of code
2) Replace Tool.AddMethod = UTAM_ADD_OR_ADJUST; with Tool.AddMethod = UTAM_ADD_ALWAYS;
3) Add the code LineNumber_2 = LineNumber_1; immediately above the existing if (LineNumber_2 != 0) line of code

When this code is run, only the first drawing is drawn, never the second.

If I simply comment out the Tool.AddAsUserDrawnDrawing = 1; line of code, then both non-user drawn drawings are successfully drawn (and I can see from debugging that they're both drawn under the same LineNumber).

So the issue definitely seems to be trying to draw them as user drawn drawings.

Even if I clear out the Tool (Tool.Clear()) and reset it (including the LineNumber with the original LineNumber from the first drawing), the second drawing is still not drawn.

This doesn't seem correct.

*********** One final question regarding the function sc.GetUserDrawingByLineNumber() **********

When user drawn drawings are drawn under the same LineNumber using ACSIL, I understand when they're retrieved using the sc.GetUserDrawingByLineNumber() function, they will each have a separate and distinct DrawingIndex() value.

My question is simply, when retrieving user drawn drawings using this function, is it possible to set the drawing properties (i.e. text for example), for each drawing individually - i.e. so each drawing could have different text, or if you change something on one drawing it's changed for all the drawings under this LineNumber (making it impossible for each to have separate and distinct text)?

I have been unable to test this, due to Issues 1 and 2 above.

I am using Sierra build 1481.

Thanks.
[2016-11-13 20:31:49]
Sierra Chart Engineering - Posts: 104368
You need to understand there is way too much information and detail here and this is outside the scope of our support. There is no way we can possibly handle this. This can be considered an abuse of support.

We will quickly review this, and see if there any issues that need to be resolved or any documentation updates. And briefly summarize those.
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-11-13 20:33:47
[2016-11-13 20:43:33]
Sierra Chart Engineering - Posts: 104368
Regarding issue 1. The documentation has been updated with this information for LineNumber:

However, using a -1 is a flag to the sc.UseTool function to automatically assign the LineNumber. So a -1 is acceptable.
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-11-13 21:06:12
[2016-11-13 21:01:41]
kas64h - Posts: 87
Thank you for your response and answering Issue 1.

I apologise if my initial post was too long, but please understand my intention was not to try and abuse support.

I was simply trying to provide as much information as possible, based upon an existing code example, to what should be a fairly straight-forward exercise (adding ACSIL user drawn drawings under the same LineNumber). Having read all the documentation, my understanding is this doesn't seem to work at present?

Thank you for your help.
[2016-11-13 21:05:01]
Sierra Chart Engineering - Posts: 104368
For issue 2, the following has been added to the documentation:
However, it is not possible to add more than one user drawn (s_UseTool::AddAsUserDrawnDrawing = 1) drawing with the same LineNumber.

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-11-13 21:10:16]
Sierra Chart Engineering - Posts: 104368
When user drawn drawings are drawn under the same LineNumber using ACSIL,
Regarding this, this is not supported to have multiple user drawn drawings with the same LineNumber.

My question is simply, when retrieving user drawn drawings using this function, is it possible to set the drawing properties (i.e. text for example), for each drawing individually - i.e. so each drawing could have different text, or if you change something on one drawing it's changed for all the drawings under this LineNumber (making it impossible for each to have separate and distinct text)?
This is not possible whether the drawing is user drawn or not and the Same LineNumber is used for them.

The documentation was not completely thorough in regards to user drawn drawings, because these are handled differently and are meant for specialized uses in ACSIL.

Thank you for your comments in post #4. Understood. Sometimes we just need to make it clear for users, there are certain bounds to our support, and going into too much detail really is often unnecessary and takes time from our other development.
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

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

Login

Login Page - Create Account