Support Board
Date/Time: Sun, 02 Feb 2025 20:03:58 +0000
Post From: ACSIL: Optimization of calculations and drawings
[2019-09-13 07:50:46] |
BrMa - Posts: 80 |
Dear ladies and gentlemen, I worked through the documentation and also tried already a lot of different approaches to resolve it but I'm stuck on the following issue: My study needs two additional charts (same instrument but different periods and maximum history) to the one it is assigned to. For doing this I'm using the function sc.OpenChartOrGetChartReference() and as I'm using the manual looping-approach I also made sure I only call the function once during full-recalculation on sc.UpdateStartIndex == 0 . In addition I'm setting the parameter HideNewChart = 1 to avoid time consuming drawing-operations.Debugging shows the recalculation of the study takes place three times (obviously the referenced charts tag if for recalculation and one time the recalculation takes place because of its own loading). However - as there is a lot of processing to do and many drawings to be made, the study turns out to be pretty slow. Topic 1: Calculations First of all, I'd like to achieve that calculations are only done once and not three times during the initial loading of the chart. To achieve this I already tried to detect "unnecessary" processing by using the functions sc.ChartIsDownloadingHistoricalData() and sc.IsChartDataLoadingInChartbook() . The idea behind: as long as data is loaded in the chartbook, there is no processing necessary as the main chart will be tagged for re-calculaton anyhow. Unfortunatelly this does not work because sc.ChartIsDownloadingHistoricalData() seems to return false if data is cached or downloaded already and seems not to be useful to determine if the main-chart will be tagged for a redraw. sc.IsChartDataLoadingInChartbook() seems also to be true if the main-chart is not downloading data anymore but processing the study - waiting for this to be false leads to the outcome, that no processing is done.So my question: how can I check that: 1) all necessary data is loaded 2) referenced charts are processed and do not tag any redraws to the main chart for the process of opening anymore 3) and it is the "last" processing of the data out of the initial loading - so the "last" full recalculation Topic 2: Drawings Drawings seem to be very time-consuming in the processing of studies (if I'm doing the processings only without drawings during the opening of a chart, time-savings are up to 60% - during "ongoing" calculations on chart-updates it's up to 100%). And - of course - I'm "remembering" drawing-IDs and re-using them to make sure there are no multiple-drawings of the same item. This is especially critical during the ongoing updating of charts as the workload on the core used easily comes to its maximum although there are no calculations done in the study. (Amendment: I also checked the beta-functionailty of OpenGL already, but my GPU goes up to 100% and stays there leaving the system in a stalled state. So, this is not an option for me for the time being.) I tried to work around this issue by only drawing "visible marks" using sc.IndexOfFirstVisibleBar and sc.IndexOfLastVisibleBar but when doing historical analysis offline those are not updated and therefore "redraws" need to be forced by re-applying the settings to the study.My question: is there a way to speed up drawing or to get the "visible" area in ACSIL if the chart is not triggered by an update but by scrolling the chart? Thanks a lot for your suggestions on this in advance! |