Login Page - Create Account

Support Board


Date/Time: Wed, 25 Dec 2024 13:35:41 +0000



Post From: Passing SCGraphData Object as argument

[2015-11-06 01:27:47]
reticent67 - Posts: 4
Hi,
I’m coding a strategy based on four custom studies I have coded. Each study has multiple subgraphs. I am using a SCGraphData object and mapping my subgraphs in with GetStudyArraysFromChartUsingID() to SCFloatArray’s.

  
SCGraphData D_S;
  sc.GetStudyArraysFromChartUsingID(DS.GetChartNumber(), DS.GetStudyID(), D_S);

  int RefChartIndex = sc.GetContainingIndexForDateTimeIndex(DS.GetChartNumber(), sc.Index);


  SCFloatArray DubStoch = D_S[0];
  SCFloatArray DS_Sig = D_S[5];
  SCFloatArray DS_OB = D_S[6];
  SCFloatArray DS_OS = D_S[7];

This works fine when I generate signals from within the strategy function, but since I have multiple studies and each study generates multiple signals, I would like to create a helper function for each study. However, when I try to pass the SCGraphData object (in this case D_S), the data doesn’t get passed with it. Well, the data for the main subgraphs – the double stochastic and its signal line – remains at zero for every bar. But the values for the overbought and oversold lines show they got passed when I debug.
Is there a trick to passing the Graph Data object? Or is it better to just pass each float array as a parameter?