Support Board
Date/Time: Fri, 27 Dec 2024 01:03:35 +0000
Post From: Percentage Scales on Charts based on first visible bar
[2016-03-13 06:51:55] |
Dema - Posts: 42 |
Hi Team, I have attempted to code this feature (see below), however, the chart requires a manual recalculate (Ctrl+Ins) upon scrolling/zooming which is not practical. The global update interval is default 500ms and there is no override on the chart. Could you please suggest why the auto-loop isn't being triggered automatically? I do have sc.UpdateAlways = 1. Thankyou. SCSFExport scsf_PercentageChangeVisible_AutoLoop(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Percentage Line AUTO Loop DZ"; sc.StudyDescription = "Percentage Line AUTO Loop calculates percentage change from first visible bar"; sc.AutoLoop = 1; sc.FreeDLL = 1; sc.UpdateAlways = 1; sc.Subgraph[0].Name = "LAST Line"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; sc.Subgraph[0].LineStyle = LINESTYLE_DOT; sc.Subgraph[0].DrawZeros = 1; return; } if(sc.Index == 0 || sc.Index <= sc.IndexOfFirstVisibleBar) { sc.Subgraph[0][sc.Index] = 0.0f; } else { sc.Subgraph[0][sc.Index] = 100.0f * (sc.BaseData[SC_LAST][sc.Index] - sc.BaseData[SC_LAST][sc.IndexOfFirstVisibleBar]) / sc.BaseData[SC_LAST][sc.IndexOfFirstVisibleBar]; } } |