Support Board
Date/Time: Sat, 08 Feb 2025 20:54:28 +0000
Post From: Understanding arrays.
[2020-07-21 09:53:24] |
gfx2trade - Posts: 48 |
Hi SC Team, I am still confused with handling arrays. Below my cpp code which works fine. // Graphs & Input
SCSubgraphRef Subgraph_Highest = sc.Subgraph[0]; SCSubgraphRef Subgraph_Lowest = sc.Subgraph[1]; // Working // Section 1 - Set the configuration variables and defaults if (sc.SetDefaults) { sc.GraphName = "TEST HL"; sc.StudyDescription = "This is the gfx KiJun-Sen indicator"; sc.DrawZeros = false; sc.GraphRegion = 0; sc.ValueFormat = sc.BaseGraphValueFormat; Subgraph_Highest.Name = "RBH"; Subgraph_Highest.DrawStyle = DRAWSTYLE_LINE; Subgraph_Highest.LineWidth = 1; //Width of arrow Subgraph_Highest.PrimaryColor = RGB (0, 0, 255); // Green Subgraph_Lowest.Name = "RBL"; Subgraph_Lowest.DrawStyle = DRAWSTYLE_LINE; Subgraph_Lowest.LineWidth = 1; //Width of arrow Subgraph_Lowest.PrimaryColor = RGB (0, 0, 255); // Green sc.AutoLoop = 1; sc.AlertOnlyOncePerBar = true; return; } // ************************************ // Section 2 - Do data processing here // ************************************ int index = sc.Index; int OutputIndex = index + 0; sc.Highest(sc.BaseDataIn[SC_HIGH], sc.Subgraph[0], 20); sc.Lowest(sc.BaseDataIn[SC_LOW], sc.Subgraph[1], 20); Is there a way to avoid using sc.Subgraph[] to store intermediate data. Eventually I would like to end up with ... SCSubgraphRef Subgraph_Mid = sc.Subgraph[0]; sc.Highest(sc.BaseDataIn[SC_HIGH], A, 20); sc.Lowest(sc.BaseDataIn[SC_LOW], B, 20); Subgraph_Mid[index] = (A+B)/2 Thks |