Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 21:03:28 +0000



Drawing Tool problems with Custom Profile study

View Count: 852

[2018-02-19 07:05:32]
WarriorTrader - Posts: 245
Hello,

I have study that displays a separate one day TOP chart in the fill space of any remote chart. It has been in use by the SC community for over 3 years. It is a convenient way to have two TPO charts for the same day on the same chart, so one can expand one into columns and the other can be just a regular profile. About 5 month ago it stopped working when v1587 came out.

It now only displays one letter or nothing at all.


Thread: Custom Market Profile Chart

https://www.sierrachart.com/Download.php?Folder=SupportBoard&download=4804
https://www.sierrachart.com/Download.php?Folder=SupportBoard&download=4492

Although the logic did not change I checked it anyway to make sure it is noting on my end.

The culprit is the AddAsUserDrawnDrawing UseTools setting. All my drawing tools have it set as follows:

LetterTPO.AddAsUserDrawnDrawing = 1;

When I switched one drawing tool to AddAsUserDrawnDrawing = 0 parts of the “custom profile” in the fill space showed up as expected (see ToolError1 attached).

Then I switched the study to display on a remote chart (from the study settings), as the study is designed to do, and only one letter is displayed. The rest of the study is displayed in the original chart. (see Tool Error2 attached).


Then I tried to switch the chart back to the original chart and the “custom profile” no longer showed up as it did before. This probably is a separate issue dealing with remote charts but you will have to let me know about that (see ToolError3 attached).

The last two pics attached show what is displayed after the v1587 upgrade.

Only one letter shows up ( see ToolError4 and 5).

There is also an inconsistent error when I switch to the remote chart and then back to the original chart in the study settings. Sometimes the “custom profile” shows up and sometimes it does not. Sometimes I just have to press “Insert” to refresh the chart and it shows up as expected and sometimes I have to restart SC and then it comes up fine. So I suspect there is something going on with how remote charts are handled also.

Chartbook also included.


I have included the code of the drawing tool that is being tested. I only changed the AddAsUserDrawnDrawing setting on that tool to keep it simple. The original code is 1500 lines so I will not bother you with that.

I also included two dll’s. One with AddAsUserDrawnDrawing = 1 named _one and one with it = 0 named _zero

The dll’s was compiled with Visual Studio Community 2015 in SC v1689


A lot of people have been asking me to fix the study because it duplicates a feature in other software packages; so many of your users look forward to getting it back up and running.

Thx,
WarriorTrader

PS: The if then statements in the code only deal with the color of the drawing tool so you can take them out for clarity.

            else { //use letters

              LetterTPO.Clear(); // Reset tool structure. Good practice but unnecessary in this case.
              LetterTPO.ChartNumber = RemoteChart; //sc.ChartNumber;
              LetterTPO.AddAsUserDrawnDrawing = 1;

              LetterTPO.DrawingType = DRAWING_TEXT;
              LetterTPO.TextAlignment = DT_VCENTER | DT_CENTER;
              //LetterTPO.MarkerType = MARKER_SQUARE;
              //LetterTPO.UseBarSpacingForMarkerSize=1;
              LetterTPO.FontSize = TPOFontSize.GetInt();
              LetterTPO.LineNumber = 6417888;
              


              //BarIndex = max(0, sc.ArraySize - 35);
              //LetterTPO.BeginIndex = SavedPrevHighPivotIndex;
              
       LetterTPO.BeginDateTime = ProfileDateTime[ProfileSize + LevelCount[StaticLength] + 1];
//(LevelCount[StaticLength]+1)*-1;
              LetterTPO.BeginValue = CurrentValue;
              char LetterOut;
              if (LevelCount[StaticLength + Offset] > 25)
                LetterOut = 'Z';
              else
                LetterOut = LetterArray[HistoryIndex - DyanmicLookbackIndex + Offset]; //LetterArray[LevelCount[StaticLength]-1];

              LetterTPO.Text.Format("%c", LetterOut);

              if (HistoryIndex == DyanmicLookbackIndex) {

                if (sc.Open[DyanmicLookbackIndex] == CurrentValue) {
                  LetterTPO.Color = OpenColor.GetColor();
                }
                else {
                  LetterTPO.Color = BalancedColor.GetColor();
                }
              }

              else if (CurrentValue > (sc.High[HistoryIndex - 1] + TICK))

                LetterTPO.Color = BreakoutColor.GetColor();

              else if (CurrentValue < (sc.Low[HistoryIndex - 1] - TICK))

                LetterTPO.Color = BreakdownColor.GetColor();
              else

                LetterTPO.Color = BalancedColor.GetColor();

              LetterTPO.AddMethod = UTAM_ADD_ALWAYS;
              //LetterTPO.MarkerSize = BlockSizeNum;
              //LetterTPO.LineWidth = 3;

              sc.UseTool(LetterTPO);

Date Time Of Last Edit: 2018-02-19 09:44:19
imageToolError1.png / V - Attached On 2018-02-19 06:37:13 UTC - Size: 96.23 KB - 300 views
imageToolError2.png / V - Attached On 2018-02-19 06:37:30 UTC - Size: 138.17 KB - 281 views
imageToolError3.png / V - Attached On 2018-02-19 06:37:43 UTC - Size: 132.78 KB - 236 views
imageToolError4.png / V - Attached On 2018-02-19 06:37:52 UTC - Size: 92.54 KB - 281 views
imageToolError5.png / V - Attached On 2018-02-19 06:38:00 UTC - Size: 108.09 KB - 271 views
Private File
Private File
attachmentCustomProfile_SC_1684.dll - Attached On 2018-02-19 06:44:19 UTC - Size: 110 KB - 297 views
attachmentCustomProfileTest.Cht - Attached On 2018-02-19 06:44:44 UTC - Size: 61.91 KB - 295 views
[2018-02-19 10:54:16]
Sierra Chart Engineering - Posts: 104368
Always check the return value of the sc.UseTool function. You will see it is returning 0 when the drawing is not added.


When using UTAM_ADD_ALWAYS, you cannot use the same Line Number. You should always let Sierra Chart automatically assigned that. This will not work:
LetterTPO.LineNumber = 6417888;

Refer to Line Number:
https://www.sierrachart.com/index.php?page=doc/ACSILDrawingTools.html#LineNumber


This is from the 1575 release notes:
When adjusting a Chart Drawing from ACSIL, if more than one Chart Drawing uses the same LineNumber, only the first found drawing will be adjusted for performance reasons. Therefore, it is not considered best practice to use the same LineNumber for different Chart Drawings added by the ACSIL sc.UseTool function.

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-02-19 10:55:00
[2018-02-19 19:05:14]
WarriorTrader - Posts: 245
When using UTAM_ADD_ALWAYS, you cannot use the same Line Number. You should always let Sierra Chart automatically assigned that. This will not work:
LetterTPO.LineNumber = 6417888;




Ok thx. I will make the necessary changes. How should I go about deleting the drawing objects? Does the SC generated line number need to be saved in an array so it can be deleted?

Thx,
WT
[2018-02-19 22:42:08]
Sierra Chart Engineering - Posts: 104368
This is a good question and the documentation here has been updated about this:
https://www.sierrachart.com/index.php?page=doc/ACSILDrawingTools.html#LineNumber

In the case when LineNumber is automatically set when s_UseTool::AddAsUserDrawnDrawing is set to 1 or a nonzero number, the automatically assigned LineNumber may be a negative number or it may be a positive number. When adding Chart Drawings during the calling of the study function, it will continuously decrement to a more negative number, or decrement to a less positive number, depending whether it is negative or positive, without any skips of numbers. Therefore, when adding a range of drawings you can remember the beginning LineNumber and the ending LineNumber to later be able to reference that range of drawings for modification or deletion. Remember these values in Persistent Variables.

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-02-20 10:58:59

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

Login

Login Page - Create Account