Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 13:41:10 +0000



[Programming Help] - ACSIL - Couple of questions on sc.GetStudyArrayUsingID

View Count: 1863

[2016-10-23 03:37:18]
ejtrader - Posts: 688
SC Team - Trying to use this function sc.GetStudyArrayUsingID() and have couple of questions in this regard.

Question 1: Does this code - Tries to copy entire subgraph values(sg[0][0] till sg[0][sc.ArraySize-1]) for the chart every tick or just populates the reference to the subgraph? Just trying to save CPU cycles and would change the design if indeed - All the values gets copied every tick with below function.
SCFloatArray Study1Array;
sc.GetStudyArrayUsingID(StudySugbraph1.GetStudyID(), StudySugbraph1.GetSubgraphIndex(), Study1Array);


Question 2: Is there any function available to get just the subgraph value(or a reference) at specified Index of Study 1 from Study 2 on the same chart.

For example - wanted to retrieve the value(or reference) of [study1][subgraph1][sc.Index] from study 2 - on the SAME chart.

anything in the form - SubgraphRef v = sc.GetSubGraphRef[StudyID][SubGraphID][Index]

Thanks
Date Time Of Last Edit: 2016-10-24 14:17:32
[2016-10-29 03:20:45]
ejtrader - Posts: 688
SC Team - Would you please comment on this. Please note that - not seeking for a programming help here.

Would like to understand whether this function - sc.GetStudyArrayUsingID() - copies entire array elements to the local array for every tick - I would pick a different structure for the code or if any function available to access the sug-graph data corresponding to an index would it directly.

Thanks
[2016-10-31 05:18:50]
Sierra Chart Engineering - Posts: 104368
This is considered programming help.

Anyway, when getting a Subgraph array for a study or the main price graph, in the same chart or another chart, it is only getting a reference to it. Never a copy because that is not efficient.
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: 2016-10-31 05:19:31
[2016-11-05 22:22:19]
ejtrader - Posts: 688
SC team - Running into an issue with GetArraySize() as it seems to return the value much smaller than GetNearestMatchForDateTimeIndex() function. Would you please let me know if GetArraySize function is correct? I understand that this is somewhat of a programming help. But this is very simple form and unable to understand the reason why this would return smaller size. All functions are built-in functions.

Appreciate if you could check and confirm if there is indeed an issue with SCGraphData.GetArraySize() function or not.

Just trying to determine the exact number of elements in ReferenceArrays and assuming ReferenceArrays.GetArraySize() is the correct function to use for this purpose.


SCGraphData ReferenceArrays;
sc.GetChartBaseData(sc.ChartNumber, ReferenceArrays);

int RefDataIndex = sc.GetNearestMatchForDateTimeIndex(sc.ChartNumber, sc.Index);

SCString Message;

Message.Format("GetArraySize: %d", ReferenceArrays.GetArraySize());
sc.AddMessageToLog(Message, 0);

Message.Format("RefDataIndex: %d", RefDataIndex);
sc.AddMessageToLog(Message, 0);

PS: Please do not mark it as programming help as I am really stuck on this - and just not able to think of a reason for this behavior.

Thanks.
Date Time Of Last Edit: 2016-11-05 22:37:50
imagesc_GetArraySize_issue.jpg / V - Attached On 2016-11-05 22:21:30 UTC - Size: 27.13 KB - 295 views
[2016-11-05 22:35:03]
Sierra Chart Engineering - Posts: 104368
This is going to be a chargeable support request.

There is no way we can afford to provide you support any longer at the low prices we charge for Sierra Chart. There is no way you can have any other expectation with the massive support load you have placed on us over the years.

Deposit an additional 100 USD into your account. Although we do not expect the cost of this to be more than 20 USD.
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: 2016-11-07 07:11:50
[2016-11-05 22:43:46]
ejtrader - Posts: 688
So - what is the charge for the following?


- Pointing - ReferenceArrays.GetArraySize() - is NOT returning the correct value?
- if this is NOT the correct function - what is the function to use?

Date Time Of Last Edit: 2016-11-05 22:44:17
[2016-11-06 04:30:23]
ejtrader - Posts: 688
I think - ReferenceArrays.GetArraySize() - seems to represent SC_SUBGRAPHS_AVAILABLE Value.

Would figure out a way to get the real number of elements from other chart.

For "your" convenience - marked it as "programming help" - to "reduce" the overhead on your part.
[2016-11-06 13:29:11]
ejtrader - Posts: 688
For anyone interested - Here is the solution for this.


SCGraphData ReferenceArrays;
sc.GetChartBaseData(sc.ChartNumber, ReferenceArrays);

int RefDataIndex = sc.GetNearestMatchForDateTimeIndex(sc.ChartNumber, sc.Index);

SCString Message;

Message.Format("GetArraySize: %d", ReferenceArrays[SC_OPEN].GetArraySize() - 1);
sc.AddMessageToLog(Message, 0);

Message.Format("RefDataIndex: %d", RefDataIndex);
sc.AddMessageToLog(Message, 0);

imagesc_GetArraySize_corrected.jpg / V - Attached On 2016-11-06 13:29:02 UTC - Size: 22.07 KB - 348 views
[2016-11-06 13:37:49]
Forward - Posts: 65
Thank you very much dear ejtrader !
[2024-03-01 16:25:36]
User129860 - Posts: 33
@ejtrader : wonder if you'd able to solved your issue when using sc.GetStudyArrayUsingID() to get ref study subgraph value?
Im having issue with same code:
SCFloatArray Study1Array;
sc.GetStudyArrayUsingID(Input_StudySubgraph1.GetStudyID(), Input_StudySubgraph1.GetSubgraphIndex(), Study1Array);

My input study is Color Bar Base on Alert Condition and I need to get value of the first Subgraph ( Color Bar ). Other study seem fine except this study.
[2024-03-01 16:47:06]
User907968 - Posts: 823
Other study seem fine except this study.

ACSIL Interface Members - Variables and Arrays: sc.CalculationPrecedence
Chart Studies: Study Calculation Precedence And Related Issues

CBBOAC is very low precedence (lowest possible), so your study needs to be the same and appear below it in the studies list.
[2024-03-01 17:23:55]
User129860 - Posts: 33
Thank you very much! @User907968. you saved my day

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

Login

Login Page - Create Account