Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 12:27:14 +0000



Why aren't these functions working?

View Count: 448

[2023-08-08 22:30:24]
User1293821 - Posts: 42
I am trying to use sc.AddStudyToChart and sc.RemoveStudyFromChart in combination with sc.IsChartbookBeingSaved and sc.LastCallToFunction.

sc.IsChartbookBeingSaved - works when a chartbook is just saved, but not when a chartbook is closed and save all is selected
sc.LastCallToFunction - works when the custom study is removed, but not when a chartbook is closed.

I have tried adding another sc.SaveChartbook() as well but that didnt change the outcome when the chartbook is re-opened.



if (sc.GetStudyIDByIndex(sc.ChartNumber, 2) == 0)
{
n_ACSIL::s_AddStudy AddStudy;
AddStudy.ChartNumber = sc.ChartNumber;
AddStudy.StudyID = 2;
AddStudy.ShortName = "New Moving Average";
sc.AddStudyToChart(AddStudy);
}

if (sc.IsChartbookBeingSaved)
{
sc.RemoveStudyFromChart(sc.ChartNumber, 2);
sc.SaveChartbook();
}

if (sc.LastCallToFunction)
{
sc.RemoveStudyFromChart(sc.ChartNumber, 2);
sc.SaveChartbook();
}


My question is just is why aren't the add/remove functions working in those instances.

Thanks.
[2023-08-09 00:27:22]
User1293821 - Posts: 42
GetCharttudyHideStudy and SetChartStudyHideStudy are causing CPU exceptions on load which is different behavior from above.
[2023-08-09 15:48:24]
Sierra_Chart Engineering - Posts: 17191
Are you sure about this?:
sc.LastCallToFunction - works when the custom study is removed, but not when a chartbook is closed.

Check again.

Test with the latest prerelease of Sierra Chart:
GetCharttudyHideStudy and SetChartStudyHideStudy are causing CPU exceptions on load which is different behavior from above.

Yes this probably does make sense and will not change:
sc.IsChartbookBeingSaved - works when a chartbook is just saved, but not when a chartbook is closed and save all is selected

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: 2023-08-09 15:49:25
[2023-08-09 16:23:34]
User1293821 - Posts: 42
1. sc.LastCallToFunction - The function should get called when a chartbook is closed correct? If yes then I am sure sc.RemoveStudyFromChart is not being working because when I close a chartbook (tried save all and not), release all dlls and then re-open the chartbook the study is still applied. Have tried on a different sierra install as well.


2. I updated to pre-release 2534 and still the same issue with both sc.GetChartStudyHideStudy & sc.SetChartStudyHideStudy
SCSFExport scsf_Add_Remove(SCStudyInterfaceRef sc)

{

if (sc.SetDefaults)
{
// Set The Study Defaults
sc.GraphName = "Test Remove";
sc.GraphShortName = "Test Remove";
sc.GraphRegion = 0;
sc.AutoLoop = 1;
sc.FreeDLL = 0;
return;
}

sc.GetChartStudyHideStudy(sc.ChartNumber, 0);

// if (sc.GetStudyIDByIndex(sc.ChartNumber, 2) == 0)
// {
// n_ACSIL::s_AddStudy AddStudy;
// AddStudy.ChartNumber = sc .ChartNumber;
// AddStudy.StudyID = 2;
// AddStudy.ShortName = "New Moving Average";
// sc.AddStudyToChart(AddStudy);
// }

// if (sc.LastCallToFunction)
// {
// // sc.RemoveStudyFromChart(sc.ChartNumber, 2);
// sc.SetChartStudyHideStudy(sc.ChartNumber, 2, 1);
// }
}
[2023-08-10 22:01:02]
Sierra_Chart Engineering - Posts: 17191
1. Yes that will be set to true when a Chartbook is closed. But we do not understand the rest of what you are saying.

You certainly cannot be removing a study from a chart when closing a Chartbook. That is not going to work properly at all.

2. We will check this.
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
[2023-08-10 23:04:18]
Sierra_Chart Engineering - Posts: 17191
2. This will be resolved 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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-08-10 23:16:56]
User1293821 - Posts: 42
1. The plan was to add all studies on chartbook load or adding of custom study and remove all studies on chartbook closure, but that is fine if those functions were not intended to work that way.

2. Awesome thank you SC team!
[2023-08-12 15:52:07]
Sierra_Chart Engineering - Posts: 17191
2. Update Sierra Chart to resolve this. Instructions:

Software Download: Fast Update
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: 2023-08-12 15:52:13

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

Login

Login Page - Create Account