Login Page - Create Account

Support Board


Date/Time: Mon, 20 Oct 2025 21:46:38 +0000



Compatibility Issue: Retrieving SC_LAST_RUN_OF_STUDY State for Destructor Logic (ACSIL/C++

View Count: 98

[2025-10-10 20:22:41]
User138417 - Posts: 2
Dear Sierra Chart Support Team,

We are developing a custom trading system (ACSIL/C++) and are encountering persistent compilation errors when trying to implement the necessary memory cleanup (Destructor logic) within the scsf_TrendPatternBotV7 study function.

The goal is to safely detect when the study is removed from the chart (SC_LAST_RUN_OF_STUDY state) in the sc.SetDefaults block, to correctly delete persistent memory objects allocated via new and stored using sc.SetPersistentPointer().

Our compiler environment seems to lack support for the modern templated functions and the commonly cited member variable.

Attempted Solutions (All Failed Compilation)

We have attempted to use all known methods to check for the Destructor state, all resulting in compilation errors (e.g., error C2039: "Is" is not a member of "s_sc" or "Member not found"):

Modern Templated Function:

C++
if (sc.Is<bool>(SC_LAST_RUN_OF_STUDY))
(Fails: "Is" is not a member)

Classic Direct Member Access (as cited in documentation/forums):

C++
if (sc.LastRunOfStudy)
(Fails: "LastRunOfStudy" is not recognized as a member)

Classic Integer Check:

C++
if (sc.LastRunOfStudy != 0)
(Fails: "LastRunOfStudy" is not recognized as a member)

Legacy Function Check (Documentation Search only): We could not confirm the existence of sc.GetOperationType through the documentation search.

Request for Resolution

Could you please advise on the correct and fully compatible API/function/member to reliably retrieve the SC_LAST_RUN_OF_STUDY state, especially for environments where the sc.Is<T> template and the sc.LastRunOfStudy member are not available?

We need this working API to prevent Memory Leaks when our study is removed from a chart.

Thank you for your assistance.

Sincerely, Tom
[2025-10-10 20:56:54]
ForgivingComputers.com - Posts: 1150
This is the correct function. It should be outside the sc.SetDefaults block.

ACSIL Interface Members - Variables and Arrays: sc.LastCallToFunction
[2025-10-10 21:14:37]
User138417 - Posts: 2
🤗
[2025-10-11 17:14:27]
Sierra_Chart Engineering - Posts: 21166
The goal is to safely detect when the study is removed from the chart (SC_LAST_RUN_OF_STUDY state) in the sc.SetDefaults block,
This does not make sense. You cannot detect, when the study is removed from the chart within the sc.SetDefaults code block. It must be outside.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2025-10-11 17:15:41

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

Login

Login Page - Create Account