Login Page - Create Account

Support Board


Date/Time: Tue, 17 Jun 2025 05:18:41 +0000



Post From: sc.AddStudyToChart issue??

[2025-05-12 21:05:47]
Richard Chinn - Posts: 35
Hi guys,

I recently reported that sc.GetStudyIDByIndex and sc.GetStudyIDByName were returning zero.
In my program they are BUT it looks like the issue is not either of those functions,
It looks like the issue I'm having originates at the sc.AddStudyToChart function.

Simply put if I manually add studies to my chart everything looks good.
I added these studies manually via the studies window:

MovingAverage - Exponential S_ID 27
MovingAverage - Simple S_ID 2

I get the correct values from sc.GetStudyIDByName and sc.GetStudyIDByIndex.
I get 1 and 2 respectively.

However; if I add the studies by using sc.AddStudyToChart, the return values from both functions are always zero.
This is all I am doing:


n_ACSIL::s_AddStudy addStudy;
addStudy.StudyID = 27;
addStudy.ShortName = "MovingAverageExponential";
addStudy.ChartNumber = 1;

sc.AddStudyToChart(addStudy);

int studyInstanceByIndex = sc.GetStudyIDByIndex(addStudy.ChartNumber, addStudy.StudyID); // Returns 0
int studyInstanceByName = sc.GetStudyIDByName(addStudy.ChartNumber, addStudy.ShortName, true); // Returns 0


Thanks for any help you can supply!
Richard