Login Page - Create Account

Support Board


Date/Time: Sun, 06 Jul 2025 21:01:39 +0000



Setting Persistent variables in the sc.SetDefaults Code Block

View Count: 893

[2020-03-12 12:00:41]
kas64h - Posts: 87
Please note the following issue occurs only when a Study already exists on a chart, and that chart is being OPENED, not when ADDING a fresh study to a chart.

I'm setting persistent varibles in the sc.SetDefaults Code Block, which are not persisted after the initial call to set the Defaults of the study. For example:

int &Initializing = sc.GetPersistentInt(0);

if (sc.SetDefaults)
{
Initializing = 2;
return;
}

The Initializing persistent variable is being successfully set inside the sc.SetDefaults Code Block, but on the next call to do the Full Recalculation, Initializing is 0 (i.e. it hasn't been persisted).
I know this used to work, and thought this was still the intended behaviour (ACSIL Interface Members - Functions: sc.GetPersistentInt())

This behaviour seems to be for any persistent variable, not just Ints

Persistent variables defined and set after the sc.SetDefaults Code Block are still working fine.
[2020-03-13 09:49:00]
Sierra Chart Engineering - Posts: 104368
This will be solved in the next release.
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

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

Login

Login Page - Create Account