Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 05:27:06 +0000



Confused of difference between SCFloatArray and scFloatArrayRef

View Count: 2557

[2013-10-07 18:24:35]
gabby alindogan - Posts: 49
Hello. I am a little confused about the use of scfloatarrayref vs. scFloatArray. I created identical studies below-the top one uses scfloatarrayref, the other just scfloatarray. They yield difference results. Can someone please explain the difference and when one should use 1 over the other? THANKS.


SCSFExport scsf_Sigma3(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.AutoLoop=1;
    sc.GraphName = "SigmawArrayRef" ;
    sc.Subgraph[0].Name = "Spike3 ";
    sc.AutoLoop=1;
    sc.FreeDLL = 1;
    return;
  }
    SCFloatArrayRef Close1BB = sc.Subgraph[0].Arrays[0];
    SCFloatArrayRef Close2BB = sc.Subgraph[0].Arrays[1];
    SCFloatArrayRef Cl2ClLog = sc.Subgraph[0].Arrays[2];
    SCFloatArrayRef Sigma  = sc.Subgraph[0].Arrays[3];
    SCFloatArrayRef DollarSigma = sc.Subgraph[0].Arrays[4];
    SCFloatArrayRef Delta = sc.Subgraph[0].Arrays[5];
    SCFloatArrayRef Spike1BB = sc.Subgraph[0].Arrays[6];
    Close1BB[sc.Index] =sc.Close[sc.Index-1];
    Close2BB[sc.Index] =sc.Close[sc.Index-2];
    Delta[sc.Index] = Close1BB[sc.Index]-Close2BB[sc.Index];
    Cl2ClLog[sc.Index] = log(Close1BB[sc.Index] / Close2BB[sc.Index]);
    sc.StdDeviation(Cl2ClLog,Sigma,480);
    DollarSigma[sc.Index] = Sigma[sc.Index] * Close1BB[sc.Index];
    Spike1BB[sc.Index]=Delta[sc.Index] / DollarSigma[sc.Index];
    sc.Subgraph[0][sc.Index] =Spike1BB[sc.Index];
    return;    
}

SCSFExport scsf_Sigma4(SCStudyInterfaceRef sc)
{
  // Section 1 - Set the configuration variables
  if (sc.SetDefaults)
  {
    sc.AutoLoop=1;
    sc.GraphName = "Sigma4 " ;
    sc.Subgraph[0].Name = "Spike in Sigmas ";
    sc.AutoLoop=1;
    sc.FreeDLL = 1;
    return;
  }
    SCFloatArray Close1BB ;
    SCFloatArray Close2BB ;
    SCFloatArray Cl2ClLog ;
    SCFloatArray Sigma;
    SCFloatArray DollarSigma ;
    SCFloatArray Delta;
    SCFloatArray Spike1BB ;
    Close1BB[sc.Index] =sc.Close[sc.Index-1];
    Close2BB[sc.Index] =sc.Close[sc.Index-2];
    Delta[sc.Index] = Close1BB[sc.Index]-Close2BB[sc.Index];
    Cl2ClLog[sc.Index] = log(Close1BB[sc.Index] / Close2BB[sc.Index]);
    sc.StdDeviation(Cl2ClLog,Sigma,480);
    DollarSigma[sc.Index] = Sigma[sc.Index] * Close1BB[sc.Index];
    Spike1BB[sc.Index]=Delta[sc.Index] / DollarSigma[sc.Index];
    sc.Subgraph[0][sc.Index] =Spike1BB[sc.Index];
    return;    
}

[2013-10-07 19:44:56]
Sierra Chart Engineering - Posts: 104368
This is the correct usage:
SCFloatArrayRef Close1BB = sc.Subgraph[0].Arrays[0];

When you want to make a reference to an existing array you need to use SCFloatArrayRef.

If you rely upon all of the examples and information in the documentation, you will be fine. The documentation does specify the proper types to use in each case.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account