Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 05:01:31 +0000



Post From: SCGraphData clarification:

[2013-08-01 18:52:06]
golding - Posts: 15
SC,

In the example below, I find a difference between:

int endRefChartNdex = graphData.GetArraySize() - 1 ;
int endRefChartNdex = graphData[0].GetArraySize() - 1 ;

The former returns the same static results for each call to the PROCESS_AGENT_SIGNALS2, while the latter returns variable results (the desired behavior).

I used the former at first since the code loops thru all subgraphs in SCGraphData , so I expect the index to be consistent for all SGs.

The documentation for sc.GetStudyArraysFromChart shows use of both, first to test the SCGraphData size, then to test the SG size.

Shouldn't GetArraySize return the same result for both? Am I missing something or is this unexpected behavior?

thx
JG

==============================

Example:

inline void PROCESS_AGENT_SIGNALS2( SCStudyInterfaceRef sc, int chartNum, SCGraphData &graphData, int mode, int bgColor )
{
  int endRefChartNdex = graphData[0].GetArraySize() - 1 ;

  for ( int sgNdex = 1 ; sgNdex < NUM_SIG_CNTRL_SGS ; sgNdex++ )
  {
      sc.Subgraph[sgNdex][sc.Index] = graphData[sgNdex][endRefChartNdex] ;

======================

Documentation for sc.GetStudyArraysFromChart has the following example:

SCGraphData StudyData;
sc.GetStudyArraysFromChart(ChartNumber, 1, StudyData);

// Check if we got the data and then get the first subgraph array from the study data

if(StudyData.GetArraySize() == 0)
return;

SCFloatArrayRef StudyArray = StudyData[0];

if(StudyArray.GetArraySize() == 0)

return;