Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 06:34:20 +0000



Post From: [ACSIL] - Cost of sc.GetStudyArrayUsingID

[2023-12-28 13:03:35]
backinblack - Posts: 35
Hi,

I have a few custom studies which rely on grabbing data from multiple studies/charts. My code has a lot of snippets of following style:


SCFloatArray otherStudyArray;
sc.GetStudyArrayUsingID(otherStudy.GetStudyID(), otherStudySG.GetSubgraphIndex(), otherStudyArray);
float otherStudyVal= otherStudyArray[Index];

- I wish to understand how GetStudyArrayUsingID is working at a higher level. Is it copying the source/original array into a target array or just internally providing a reference to the source/original array? (I am assuming the 1st option would be a costlier operation for large arrays)
- For most cases, I am looking to fetch the latest value on the source array and If it is indeed the 1st option (A copy op), then I am toying with the idea of keeping the latest candle data of source array into a Persistent Variable too and accessing the PV from the study thus avoiding the need to copy the array. Does that sound like a good way to do it or are there other ways to do this as well?

Thanks

J