Login Page - Create Account

Support Board


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



Post From: Why aren't these functions working?

[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.