Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 21:49:09 +0000



Post From: Array Won't Pass to Function

[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);  
}