Login Page - Create Account

Support Board


Date/Time: Sat, 27 Jul 2024 01:31:01 +0000



Add callback registration on custom study removed event

View Count: 693

[2020-08-12 20:24:46]
maxima120 - Posts: 144
I am sure I asked several times over 10 yrs for this - I need to be able to execute clean up code when the custom study is being removed from a chart.

I need close named pipe and stop threads I created.

It can be easily done with a call to some SC internal function like RegisterCleanupCallback(*func);

It's 30 min work for you. Cmon
[2020-08-12 22:29:33]
Sierra Chart Engineering - Posts: 104368
There is a variable that you can check to see if the study is being removed. Refer to the following:
ACSIL Interface Members - Variables and Arrays: sc.LastCallToFunction

There simply should be no need for anything further. We use this variable in Sierra Chart studies, and it should be all you need.
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
Date Time Of Last Edit: 2020-08-12 22:30:01
[2023-10-17 16:17:58]
j4ytr4der_ - Posts: 932
I wanted to do the same thing when my study is removed, but using the documented function doesn't work for me:


if (sc.LastCallToFunction)
{
// This study is being removed from the chart or the chart is being closed
// Insert cleanup code here

if(sc.LoadChartDataByDateRange == 1)
sc.LoadChartDataByDateRange = 0;

MessageLogString.Format("Study removed");
sc.AddMessageToLog(MessageLogString, 0);

}


When the study is removed, if the chart is set to Use Date Range, I want to change it to Use # of days. Seems like this should be quite simple but, it doesn't do anything. No change in settings, and no MessageLog output. What am I missing? Thanks.
Date Time Of Last Edit: 2023-10-17 16:18:25
[2024-02-28 16:52:28]
j4ytr4der_ - Posts: 932
Found the error, I wasn't giving this code block its own return; and was expecting to rely on one further down the code, which wasn't working. Inserted return; at the end here and now it works great.

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

Login

Login Page - Create Account