Support Board
Date/Time: Thu, 06 Mar 2025 13:14:57 +0000
[Programming Help] - ACS Drawing Recalculation Performance
View Count: 709
[2022-01-29 17:19:06] |
User907968 - Posts: 836 |
Hello, Version 2350 / Revsion 40878M I am noticing significantly increased study recalculation times when more than one chart study is using ACS drawings such as 'DRAWING_LINE', 'DRAWING_RECTANGLEHIGHLIGHT', or 'DRAWING_RECTANGLE_EXT_HIGHLIGHT'. None of these drawings are being added as user drawn, so based on the information here - Using Drawing Tools From an Advanced Custom Study: sc.DeleteACSChartDrawing() - I would assume that the drawings are all being deleted when the study is recalculated. Here are some examples from testing today, calculation times are all microseconds. Calculation/Recalculation times with study A is drawing to chart: Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 4485 | Last Calculation Time: 34213 | 2022-01-29 09:58:58.020 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 4485 | Last Calculation Time: 5772 | 2022-01-29 09:58:58.031 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 4485 | Last Calculation Time: 33762 | 2022-01-29 09:58:58.739 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 4485 | Last Calculation Time: 5705 | 2022-01-29 09:58:58.749 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 4485 | Last Calculation Time: 34029 | 2022-01-29 09:58:59.789 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 4485 | Last Calculation Time: 5774 | 2022-01-29 09:58:59.799 Initial Calculation times with both studies A and 1 drawing to chart: Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 5563 | Last Calculation Time: 34298 | 2022-01-29 09:59:20.770 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Visible | Drawings Added by Study: 1078 | Total Drawings for All Studies: 5563 | Last Calculation Time: 6422 | 2022-01-29 09:59:21.555 Recalculation times with both studies drawing to chart: Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 5563 | Last Calculation Time: 812016 | 2022-01-29 09:59:23.054 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Visible | Drawings Added by Study: 1078 | Total Drawings for All Studies: 5563 | Last Calculation Time: 781054 | 2022-01-29 09:59:23.830 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 5563 | Last Calculation Time: 810877 | 2022-01-29 09:59:25.085 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Visible | Drawings Added by Study: 1078 | Total Drawings for All Studies: 5563 | Last Calculation Time: 772131 | 2022-01-29 09:59:25.862 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test A | Study ID: 8 is Visible | Drawings Added by Study: 4485 | Total Drawings for All Studies: 5563 | Last Calculation Time: 804666 | 2022-01-29 09:59:27.744 Chart: ESH22-CME[M] 2.50 Range #6 | Study: Drawing Test 1 | Study ID: 4 is Visible | Drawings Added by Study: 1078 | Total Drawings for All Studies: 5563 | Last Calculation Time: 772022 | 2022-01-29 09:59:28.530 I can reduce the days to load in the chart, so that there are fewer drawings to begin with, however the underlying behaviour is no different, the recalculation times increase disproportionately with each study added. Whether this is a recent phenomenon, I can't say. Date Time Of Last Edit: 2022-01-29 19:01:19
|
[2022-01-30 05:50:43] |
Sierra_Chart Engineering - Posts: 18669 |
This does not mean anything to us. We have absolutely no idea what those studies are doing. And chart drawings are implemented as efficiently as possible. the recalculation times increase disproportionately with each study added. Why? We have no idea. Only you can answer this. This is for you to determine. Those are the calculation times of your studies. Not Sierra Chart studies.And whether the studies are visible or hidden, does not mean anything to us because that has no effect on calculation time. Anyone can verify that with Sierra Chart studies. You need to answer your own questions. We have no idea. 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 Date Time Of Last Edit: 2022-01-30 06:03:43
|
[2022-01-30 12:02:49] |
User907968 - Posts: 836 |
This does not mean anything to us. We have absolutely no idea what those studies are doing.
Yes, ok understood. And chart drawings are implemented as efficiently as possible.
Yes they are very efficient and the performance is excellent, normally.Only you can answer this. This is for you to determine.
Believe me, I tried to do this before contacting you. I've profiled and optimized my code where possible, but the end result is not changed.And whether the studies are visible or hidden, does not mean anything to us because that has no effect on calculation time.
The significance of visible vs. hidden in this case is that if the study is hidden, then ACS Drawings are not added during recalculation - this is why I showed the count of drawings in the log.
|
[2022-01-30 12:10:04] |
User907968 - Posts: 836 |
I made a simple study that does nothing but add an ACS drawing at every nth bar (code attached). This is the result. All Studies Hidden i.e. no ACS Drawings: Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 0 | Last Calculation Time: 192 | 2022-01-30 05:58:42.624 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 0 | Last Calculation Time: 177 | 2022-01-30 05:58:42.624 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 0 | Last Calculation Time: 182 | 2022-01-30 05:58:42.624 Set Study ID 1 to visible, and press apply 3 times to make sure relevant values are shown in log: Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 1000 | Last Calculation Time: 193 | 2022-01-30 05:58:46.616 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 183 | 2022-01-30 05:58:46.617 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 176 | 2022-01-30 05:58:46.617 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 1000 | Last Calculation Time: 830 | 2022-01-30 05:58:48.533 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 179 | 2022-01-30 05:58:48.534 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 177 | 2022-01-30 05:58:48.534 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 1000 | Last Calculation Time: 843 | 2022-01-30 05:58:49.277 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 179 | 2022-01-30 05:58:49.278 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 1000 | Last Calculation Time: 177 | 2022-01-30 05:58:49.278 Set Study ID 2 to visible, and press apply 3 times to make sure relevant values are shown in log: Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 1000 | Last Calculation Time: 837 | 2022-01-30 05:58:55.730 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 179 | 2022-01-30 05:58:55.732 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 2000 | Last Calculation Time: 178 | 2022-01-30 05:58:55.732 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 838 | 2022-01-30 05:58:56.768 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 1320 | 2022-01-30 05:58:56.928 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 2000 | Last Calculation Time: 181 | 2022-01-30 05:58:56.928 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 160071 | 2022-01-30 05:58:57.627 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 160403 | 2022-01-30 05:58:57.786 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Hidden | Drawings Added by Study: 0 | Total Drawings for All Studies: 2000 | Last Calculation Time: 193 | 2022-01-30 05:58:57.786 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 164135 | 2022-01-30 05:59:01.230 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 2000 | Last Calculation Time: 159101 | 2022-01-30 05:59:01.390 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 185 | 2022-01-30 05:59:01.392 Set Study ID 3 to visible, and press apply 3 times to make sure relevant values are shown in log: Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 160144 | 2022-01-30 05:59:02.470 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 160353 | 2022-01-30 05:59:02.788 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 1850 | 2022-01-30 05:59:03.105 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 319732 | 2022-01-30 05:59:03.976 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 318121 | 2022-01-30 05:59:04.297 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 317448 | 2022-01-30 05:59:04.616 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 1 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 319697 | 2022-01-30 05:59:07.274 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 2 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 320400 | 2022-01-30 05:59:07.592 Chart: ESH22-CME[M] 2.00 Range #1 | Study: ACS Chart Drawing Test | Study ID: 3 is Visible | Drawings Added by Study: 1000 | Total Drawings for All Studies: 3000 | Last Calculation Time: 319604 | 2022-01-30 05:59:07.912 Calcuation/Recalculation is very good, with only drawings from 1 study - but there is a big degradation as more studies with ACS Drawings are added. Based on the simplicity of the attached code, I don't believe that this is a problem that I can solve, unless I am missing something? |
![]() |
[2022-01-31 16:48:39] |
User907968 - Posts: 836 |
Please review the attached video and let me know whether this is expected behavior or not. The study used in the video is exactly that used (and included) in the previous post. Date Time Of Last Edit: 2022-01-31 16:48:53
|
![]() |
[2022-02-03 19:28:53] |
User907968 - Posts: 836 |
Any possibility to comment further? Here is another example test code, nothing complicated, short calculation/recalculation time - consistently ~1ms. However, add two more copies of the study to simulate different studies using ACS drawings, recalculation time consistently >300ms (per study). How can I determine the reason, when it must be happening outside of the study code? SCSFExport scsf_ChartDrawingTest(SCStudyInterfaceRef sc) { auto& in_MaxDrawings = sc.Input[0]; auto& in_DrawingFrequency = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "ACS Chart Drawing Test"; sc.GraphRegion = 0; sc.AutoLoop = 0; sc.ValueFormat = VALUEFORMAT_INHERITED; sc.GlobalDisplayStudySubgraphsNameAndValue = 0; sc.DisplayStudyInputValues = 0; sc.HideDLLAndFunctionNames = 1; in_MaxDrawings.Name = "Max Drawing Count"; in_MaxDrawings.SetInt(1000); in_MaxDrawings.SetIntLimits(1, 50000); in_DrawingFrequency.Name = "Bars Between Drawings"; in_DrawingFrequency.SetInt(10); in_DrawingFrequency.SetIntLimits(5, 50); return; } for (auto barIndex = sc.UpdateStartIndex; barIndex < sc.ArraySize; barIndex++) { if (barIndex % in_DrawingFrequency.GetInt() != 0 || sc.HideStudy) continue; if (sc.GetACSDrawingsCount(sc.ChartNumber, 1) >= in_MaxDrawings.GetInt()) break; if (sc.GetBarHasClosedStatus(barIndex) == BHCS_BAR_HAS_CLOSED) { auto rectangle = s_UseTool(); rectangle.ChartNumber = sc.ChartNumber; rectangle.Region = sc.GraphRegion; rectangle.AddMethod = UTAM_ADD_ALWAYS; rectangle.BeginValue = sc.Low[barIndex]; rectangle.EndValue = sc.High[barIndex]; rectangle.BeginIndex = barIndex; rectangle.EndIndex = barIndex + 10; rectangle.DrawUnderneathMainGraph = sc.DrawStudyUnderneathMainPriceGraph; rectangle.DrawingType = DRAWING_RECTANGLEHIGHLIGHT; rectangle.Color = COLOR_BLUE; rectangle.SecondaryColor = COLOR_RED; rectangle.LineStyle = LINESTYLE_SOLID; rectangle.LineWidth = 1; rectangle.TransparencyLevel = sc.TransparencyLevel; sc.UseTool(rectangle); } } if (sc.UpdateStartIndex == 0) { const auto hidden = sc.HideStudy ? "Hidden" : "Visible"; auto msg = SCString(); msg.AppendFormat("Study ID: %d is %s | ", sc.StudyGraphInstanceID, hidden); msg.AppendFormat("Drawings Added by Study: %d | ", sc.GetACSDrawingsCount(sc.ChartNumber, 1)); msg.AppendFormat("Total Drawings for All Studies: %d | ", sc.GetACSDrawingsCount(sc.ChartNumber, 0)); msg.AppendFormat("Last Calculation Time: %d", sc.LastFullCalculationTimeInMicroseconds); sc.AddMessageToLog(msg, 1); } } |
To post a message in this thread, you need to log in with your Sierra Chart account: