Login Page - Create Account

Support Board

Date/Time: Fri, 21 Jun 2024 17:55:32 +0000

Post From: Notice: Study Exceptions in New Versions and Code Efficiency

[2020-05-05 04:48:31]
Sierra Chart Engineering - Posts: 104368
We have had several reports of users encountering exceptions with custom studies in newer versions of Sierra Chart.

The old persistent variable structure (sc.PersistVars) has been removed and has been considered out of date 5 years now. Custom studies that use this will encounter a null pointer exception. This is the reason for the problem.

Also custom studies that were recompiled in the last two years could not even use that object because it was renamed and became therefore inaccessible.

This should not lead to any instability but does prevent the study from functioning and does generate a lot of log messages. In the case where these studies are part of User Contributed studies, run the Sierra Chart installer just by performing a Fast Update:
Software Download: Fast Update

And on the installer window enable "Install Optional Components".

After the installation is complete and you run Sierra Chart, you will no longer have the issue.

In other cases, old code needs to be updated as follows.

Old code:
int& VariableName = sc.PersistVars->i1;

New code:

//The parameter 1 needs to be a unique number for each
// persistent variable. But can be the same among different
// data types. Always use low integer values to support
// the new fast upcoming persistent variable functions.
int& VariableName = sc.GetPersistentIntFast(1);

Code Efficiency:

Onto the subject of code efficiency. Study functions should use manual looping for the greatest efficiency. Automatic looping is less efficient, but not generally by much, and depending upon what the study function is doing, it could be very inefficient as compared to manual looping.

Studies which use more than a few persistent variables really do need to use manual looping. Manual looping really is the absolute best. Automatic looping was provided for convenience/simplicity a long time ago. Otherwise, it serves no other purpose.

When accessing a persistent variable when using sc.GetPersistent* functions, these must be called as minimally as possible. Not frequently. We are going to create new high-performance versions of these, as soon as possible.

If you are accessing a small number of persistent variables like less than 10, there really is not much performance impact but more than that, progressively there would be more of a performance impact.

However, in reality, the performance impact is likely to be when you have thousands of persistent variables. Otherwise, the performance impact simply would not be noticeable unless you are monitoring study performance down to the microsecond level.
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:

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-05-22 16:31:21