Login Page - Create Account

Support Board


Date/Time: Sat, 08 Feb 2025 17:40:27 +0000



Post From: Know what Arrays contain data

[2020-07-13 15:39:07]
User681150 - Posts: 62
i wanted to use this MACD function to understand how to access the arrays and knowing which arrays the data exist in... please correct any errors in the words i use.

a Subgraph has 12 arrays. this macd stores the 3 data arrays in sc.Subgraph[0]. you can access and plot each data array by accessing
individual arrays of sc.Subgraph[0].

- Why doesn't the first variable MACD start with Arrays[0] (isnt it zero based? isnt this the proper way to access that data array)
- Why does the second variable MACD MovingAverage use .Arrays[2] and not .Arrays[1]

with these functions that output multiple arrays... how do i know what array holds what?? in the documentatio is says
For this function, sc.Subgraph[].Arrays[0-3] (Extra Arrays) are used for internal calculations and additional results output.

any help with a little explanation would be appreciated... thanks


sc.MACD(sc.BaseData[SC_LAST], sc.Subgraph[0], 5, 10, 10, MOVAVGTYPE_SIMPLE);

//Access the individual lines
float MACD = sc.Subgraph[0][sc.Index]; //Access the study value at the current index

float MACDMovingAverage = sc.Subgraph[0].Arrays[2][sc.Index];

float MACDDifference = sc.Subgraph[0].Arrays[3][sc.Index];

//Copy to Visible Subgraphs
sc.Subgraph[1][sc.Index] = MACDMovingAverage;
sc.Subgraph[2][sc.Index] = MACDDifference;

Date Time Of Last Edit: 2020-07-13 15:57:20