Login Page - Create Account

Support Board


Date/Time: Thu, 19 Sep 2024 21:35:44 +0000



Question Regarding Autoloop = True & Data Retention STD::List ?

View Count: 1663

[2013-07-17 13:53:26]
User45685 - Posts: 36
I have a question regarding autoloop and Data retention. My Study needs to save information between function calls, the main part of the code is within the

SCDLLName("My Project Version 0.3B");

SCSFExport scsf_Projectv0.3b_modified(SCStudyInterfaceRef sc) {

}

part.

But above that i have several class and member function definitions which get called to for every functioncall/iteration of the loop that is run. I have autoloop set to 1 so that it repeats by itself without me having to write the loop myself.

Now within my code i need to store values and information within an std::list.
If i put that container within the above mentioned part of the "main" code then from what i understand there will be no data retention between function calls.

But if i place that std::list before the above mentioned code will data be retained or will it also be deleted and newly written with every function call?

The reason why I am asking is that i would like to avoid using http://www.sierrachart.com/index.php?l=doc/doc_ACSILProgrammingConcepts.html#DynamicMemoryAllocations the dynamic memory.

Kind regards
[2013-07-17 16:59:18]
Sierra Chart - Max - Posts: 5662
To retain data between function calls you will need to use the sc.PersistVars documented here:
http://www.sierrachart.com/index.php?l=doc/doc_ACSIL_Members.html#scPersistVars
Sierra Chart Support
[2013-07-17 17:55:36]
User45685 - Posts: 36
Not trying to be rude here and I appreciate how busy you guys are right now, but what exactly happens if i put the std::List container inside the global variables where my class definitions are?


[2013-07-17 19:37:17]
User45685 - Posts: 36
Another point here:

A friend of mine mentioned that putting containers inside the global variables part will basically interfere when you have the same study working on two charts...

So basically it would work but its only reasonable if you are using the study for 1 chart only.
[2013-07-17 20:39:56]
StevieD - Posts: 39
I haven't tried this, but I **think**
if your std:list is declared at the module level (preferrably as it's own class) you would be able to

if (sc.SetDefaults)
{
// init mystdlistobject

// "normal" sc.setdefault code

return;
}

And in the data processing portion of your study you would destruct


if (sc.LastCallToFunction)
{
// destruct mystdlistobject
}

Like I said, I did not try this and I do not know if this is acceptable to SCSupport or if it is usable on multiple charts.
My apologies in advance if my understanding of your question or the capabilities of SC is flawed.


[2013-07-17 21:09:01]
Sierra Chart Engineering - Posts: 104368
We have updated the Global Variables section in ACSIL Programming concepts to explain all of this better:
https://www.sierrachart.com/index.php?l=doc/doc_ACSILProgrammingConcepts.html#GlobalVariables

It should answer your questions.
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
[2013-07-17 22:01:50]
User45685 - Posts: 36
@Sierrachartengineering:

Thanks, this clarifies it quite a bit. Consider the support request resolved

@StevieD:
Thanks anyways :)
Date Time Of Last Edit: 2013-07-17 22:02:05

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

Login

Login Page - Create Account