Support Board
Date/Time: Tue, 26 Nov 2024 01:33:58 +0000
Post From: sc.EarliestUpdateSubgraphDataArrayIndex seems broken with Study/Price Overlay
[2024-01-18 21:34:19] |
User719512 - Posts: 264 |
Hello Sierra Chart Engineering, There seems to be issues with Study/Price Overlay when referencing a lower time frame chart from a higher time frame chart. I have created a small study to demonstrate/reproduce this issue. It simply draws an SG for all bars at the specified value (ON) every N bars and sets the SG value to 0 (OFF) every N bars as well. Repro Steps: Build this study and put on chart#1, a 1 second chart. Add Study/Price Overlay to chart#2, 1 second chart, and reference the study. Add Study/Price Overlay to chart#3, 10 second chart, and reference the study. Notice that chart#2 updates as expected when the study changes from ON/OFF/ON. Notice that chart#3 does NOT update as expected when the study changes from ON/OFF/ON. sc.EarliestUpdateSubgraphDataArrayIndex seems broken with Study/Price Overlay when it is on a higher timeframe chart from the source chart. Trying to work around the issue by calling sc.RecalculateChart(sc.ChartNumber) in chart#1 is not only problmatic and inefficient, it also leads to chart#1 to stop repsponding as it seems to put the chart into a infinite/bad/intensive loop. Changing Study/Price Overlay to use Nearest or Containing has no effect. Also, since other studies might be referencing this chart or this study via sc.GetStudyArrayFromChart(), how does sc.EarliestUpdateSubgraphDataArrayIndex affect these calls? It would seem other studies do not have the same access to this variable as the docs mention studies like "Study/Price Overlay study, the Color Bar Based on Alert Condition study, the Spreadsheet Studies" have in https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html#scEarliestUpdateSubgraphDataArrayIndex. Can you please comment on how studies using sc.GetStudyArrayFromChart() are impacted by changes to sc.EarliestUpdateSubgraphDataArrayIndex? Before posting this, I did search for more info, and neither of these seemed to indicate anything that would point to a problem in my code. Study/Price Overlay; Changes to source study sc.Subgraph[]. variables are not reflected Is there a way to cause chart updates with ACSIL? Sample Code: SCSFExport scsf_123_RedrawWithOverlay(SCStudyInterfaceRef sc) { SCString msg; if (sc.SetDefaults) { sc.GraphName = "123_RedrawWithOverlay"; sc.AutoLoop = 1; //Automatic looping is enabled. sc.DrawZeros = 0; sc.UpdateAlways = 1; sc.Subgraph[0].Name = "Value"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; sc.Subgraph[0].PrimaryColor = RGB(0, 255, 0); return; } if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_NOT_CLOSED) { return; } if (sc.Index < sc.ArraySize - 2) { // only process if on last bar on chart return; } int bucketSize = 10; // even number is best if ((sc.Index % bucketSize) < bucketSize/2) { if ((sc.Index % bucketSize) == 0) { // show all the SG data back to index 0 // by setting value to 0 for (int barIndex = 0; barIndex <= sc.Index; barIndex++) { sc.Subgraph[0][barIndex] = sc.Low[barIndex]; } if (!sc.IsFullRecalculation) { sc.EarliestUpdateSubgraphDataArrayIndex = 0; msg.Format("%d: Show all", sc.Index); sc.AddMessageToLog(msg, 1); } } else { // just update this index sc.Subgraph[0][sc.Index] = sc.Low[sc.Index]; } } else if ((sc.Index % bucketSize) == bucketSize / 2) { // hide all the SG data back to index 0 // by setting value to 0 for (int barIndex = 0; barIndex <= sc.Index; barIndex++) { sc.Subgraph[0][barIndex] = 0; } if (!sc.IsFullRecalculation) { sc.EarliestUpdateSubgraphDataArrayIndex = 0; msg.Format("%d: Hide all", sc.Index); sc.AddMessageToLog(msg, 1); } } } |