Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 16:43:19 +0000



How to declare variable to store data

View Count: 1344

[2018-10-22 16:05:47]
User517260 - Posts: 97
Dear Support, I need to store data in variable. Previously I declared variable before my study like shown below:
------------
#include "sierrachart.h"
SCDLLName("MyStudy")

int var1[100]

SCSFExport scsf_MyStudy(SCStudyGraphRef sc){}
------------

I used sc.ChartNumber as index of variable - var1[sc.ChartNumber] - and I didn't have problems - every instance of study used own global variable.
But after I used a few chartbooks - I've got a problem - var1[sc.ChartNumber] was shared same time for every chart with same number in every chartbook.
If chartbook may be indexed - I would use 2-dimentions variable like var1[sc.ChartNumber][sc.ChartbookNumber], but I didn't find variable in SC with number of current chartbook - only sc.ChartbookName - I can't use string variable for indexing.
What I have to do at this case? I need to store latest data in every instance of study without mutual sharing or collossions.
Waiting for your reply, Alex. Thanks!
[2018-10-22 17:39:39]
Sierra Chart Engineering - Posts: 104368
Use the persistent variable functions:
sc.GetPersistentInt()
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
[2018-10-23 07:02:32]
User517260 - Posts: 97
Thanks!
[2018-10-23 19:48:24]
User517260 - Posts: 97
Could I get numeric identificator of chartbook? I'm changing source code to use persistant variables and it seems very uneffective - if I may get numeric code of every opened chartbook instead of chartbook names - it will be mush better for me.
Date Time Of Last Edit: 2018-10-24 11:37:49
[2018-10-25 18:12:47]
Sierra Chart Engineering - Posts: 104368
Chartbook's have no numeric identifier. They just have Text names.
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

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

Login

Login Page - Create Account