Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 12:39:05 +0000



Post From: Referencing Other Charts in Current Chart

[2024-03-10 15:27:09]
Gradient - Posts: 89
Hi,

I'm attempting to load the BaseData from additional charts into the current chart.

I've implemented the sc.GetChartBaseData example found here:sc.GetChartBaseData()

The only changes I made were 1) my SCInputRef isn't "ChartNumber" it's "XLeg" 2) instead of requesting the HighArray,
I'm requesting the LastArray.

I then request the most accurate sc.Index from the ReferenceChart and store the most current last price in a
subgraph array.

However, no data is appearing from the Reference Chart.

Can someone advise?

Thanks
Below is the code block:
/ Define a graph data object to get all of the base graph data
  SCGraphData BaseGraphData;

//Note: Replaced ChartNumber with XLeg

  // Get the base graph data from the specified chart
  sc.GetChartBaseData(XLeg.GetInt(), BaseGraphData);

  // Define a reference to the High array (i.e. replaced High with Last)
  SCFloatArrayRef LastArray = BaseGraphData[SC_LAST];

  // Array is empty. Nothing to do.
  if(LastArray.GetArraySize() == 0)

  return;
  
  // Get the index in the specified chart that is
  // nearest to current index.
  int RefChartIndex =
  sc.GetNearestMatchForDateTimeIndex(XLeg.GetInt(), sc.Index);

  float NearestRefChartLast = LastArray[RefChartIndex];

    
  //store x
  sc.Subgraph[5][sc.Index]=NearestRefChartLast;