Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 21:26:53 +0000



[Programming Help] - Array Won't Pass to Function

View Count: 122

[2024-07-30 15:25:13]
maxpi - Posts: 181
Head scratcher: As evidenced by the log the following declares a function, passes an array to the function and the function never gets the array.

#include "sierrachart.h"
SCDLLName("Custom Study DLL")
int ReturnInputtedFloatArrayValue(SCFloatArray SCOpens, float& TroubleshootFloat)
{
  TroubleshootFloat = SCOpens[0];
  return 1;
}

SCSFExport scsf_FXTestCase(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "FXTestCase";
    sc.AutoLoop = 1;
    return;
  }
  SCString MessageText;
  
  SCFloatArray   SignalBarsOpen;
  SignalBarsOpen[0]  = sc.BaseData[SC_OPEN][0];
  
  sc.AddMessageToLog("============= 22 =============", 0);
  MessageText.Format("sc.BaseData[SC_OPEN][0] %f", sc.BaseData[SC_OPEN][0]);
  sc.AddMessageToLog(MessageText, 0);
  MessageText.Format("SignalBarsOpen[0] %f", SignalBarsOpen[0]);
  sc.AddMessageToLog(MessageText, 0);  
  
  float troubleshootFloat = 0;
  
  int returned = ReturnInputtedFloatArrayValue(SignalBarsOpen, troubleshootFloat);
  
  sc.AddMessageToLog("============= 32 =============", 0);
  MessageText.Format("troubleshootFloat %f", troubleshootFloat);
  sc.AddMessageToLog(MessageText, 0);  
}
[2024-07-30 18:11:48]
maxpi - Posts: 181
Ok, have to initialize the array and works fine...

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

Login

Login Page - Create Account