Support Board
Date/Time: Tue, 21 Oct 2025 00:57:08 +0000
Post From: Compatibility Issue: Retrieving SC_LAST_RUN_OF_STUDY State for Destructor Logic (ACSIL/C++
[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 |