Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 06:29:38 +0000



Detect if Chartbook is Open from ACSIL

View Count: 808

[2019-08-30 11:12:26]
User462086 - Posts: 196
Hi, is there a native function (something like 'sc.ChartbookIsOpen()' ) that checks for existence of a particular chartbook?

Alternatively is there an object array of open chartbooks that my code can loop through to find all open chartbooks?

If not, how do you recommend confirming the opening of a chartbook after using 'sc.OpenChartbook()'?

Many thanks!!
[2019-08-30 17:53:03]
Sierra Chart Engineering - Posts: 104368
No, none of this is supported. We will have to see about adding something more in this area later but we are not going to be able to get to this for a while. You can check back in about a month.
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: 2019-08-30 17:53:21
[2024-01-02 22:12:24]
PS2004 - Posts: 47
Hello!

I recently encountered this need for one of my Custom Studies.
I cannot find any information about detecting with ACSIL if a Chartbook is open in an Sierra Chart instance.
Is something like this in your roadmap now?

Greetings,
PS
[2024-01-02 23:32:38]
User719512 - Posts: 264
I don't understand your use case, but even if this API existed, it follows a pattern of not providing useful information. The user could close the chartbook right after your call to determine if it is open. They could rename some other chartbook to the name you are looking for, or rename it and then you can't find it, etc. Many boundary conditions.

A better pattern would be to perform the operations you expect possible if said chartbook was open. At least that's my 2 cents...
[2024-01-03 04:14:01]
User462086 - Posts: 196
I ended up using a global variable that was set by a study in the "child" chartbook after it was opened, and checked by a study in the "parent" chartbook. Both studies needed to be in the same file. There are plenty of posts on this support board regarding "global variables" if you get stuck.

For my use case, it was enough to increment an integer, but an SCString could also probably be stored in a global variable (not tested) & then compared with the name of the chartbook just opened. Psuedo-code would be something like:

SCString global_ChartbookName = "";

ParentStudy{
// 1) open chartbook with name "chartbookName"
// 2) on subsequent code executions,
// - check global variable for value
// - if value exists, check for match with "chartbookName"
// - if match, do something...
}

ChildStudy{
// set global variable to chartbook's name
}

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

Login

Login Page - Create Account