Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 16:24:21 +0000



Post From: SOLVED Issue with function sc.GetOrderForSymbolAndAccountByIndex(...)

[2025-02-24 23:11:42]
LTSys - Posts: 68
see if this keeps the loop from exiting. Other than that, I'm outta ideas. Maybe someone else will jump in.

Thanks for your help, your ideas help me to find the issue.

The value of the global tradeAccount variable was being re-assigned a new value after a while. Hence why it worked sporadically and put me on this lost path trying to find the cause.

The fix was to do a new char[64], a memset, and a memcpy.

Appreciate your effort alot... hopefully I can return the effort some day.


Here is the code that fixed the issue...


bool firstFunctionCall = true;

char *tradeAccount = new char[128]; // global

SCSFExport scsf_MainFunction(SCStudyInterfaceRef sc) {

// some other code

if(firstFunctionCall) {

const char *tmp = accountInput.GetSelectedCustomString().GetChars();
      
memset(tradeAccount, 0x00, 128); // reset buffer
      
memcpy(tradeAccount, tmp, strlen(tmp));

firstFunctionCall = false;
}

// get orders loop...
}

Date Time Of Last Edit: 2025-02-25 12:37:13