Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 19:54:52 +0000



Post From: Can SC PersistVars be used for a string variable?

[2013-05-25 18:18:04]
ejtrader - Posts: 688
SC Team - in ACSIL - there is a need for me to expose the symbol name through Global Variables but would like to use the same DLL for multiple instruments. This is related to GDI function as we can't use SC structure at this time.. Wondering if SC persist Variables are likely to help.. I am able to use int/float to expose globally(using sc persist variables indirectly as pointers) but unable to do so for strings..

Can you please provide a helping hand here - if this is technically possible?

//Pseudo code

// Global Vars section
const char* symbol=nullptr;

void GDIfunction()
{
//Print Symbol Name on the Chart
}

void printVars(SCStudyInterfaceRef sc)
{
SCString gmessage;
gmessage.Format("symbol:%s", symbol); // This works as expected for a single instrument - but not simultaneously for multiple instruments at the same time
sc.AddMessageToLog(gmessage, 0);
return;
}

void initVars(SCStudyInterfaceRef sc)
{
if(symbol==nullptr) symbol=sc.Symbol.GetChars();
return;
}

int main()
{
initVars(sc);
printVars(sc);
sc.p_GDIFunction=GDIfunction; // Wanted to send the SymbolName Somehow to GDI function and don't want to use different DLLs for symbol specific
return 0;
}


Date Time Of Last Edit: 2013-05-26 01:20:12