Support Board
Date/Time: Thu, 16 Jan 2025 14:02:01 +0000
[Programming Help] - ASCIL- Passing value to/from custom study
View Count: 912
[2017-10-30 21:04:11] |
vectorTrader - Posts: 86 |
I am working on generalizing some of my functions and I wanted to know how to pass values between 2 separate studies- For example, I would like to pass the output from study1 subgraph to study 2 subgraph. Study 2 would perform some manipulation on the received data and then return some output for use in study 1 to use. I know its possible, but I don't understand how to pass data back and forth and where to find more information about it. thanks |
[2017-10-30 22:19:19] |
CustomIndicators - Posts: 126 |
How about using persistent variables? To get/set persistent variables on studies on other charts, you can use: https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scGetStudyPersistentIntFromChart |
[2017-10-31 02:23:49] |
vectorTrader - Posts: 86 |
I tried your suggestion by passing a value from study 1 to study 2 using the getpersistanti tfromchart. i tried to pass a value between 1 and 10 but the retrieved value just keeps growing and not changing per the study 1 function. So I pass a sub graph instead and if so, how would I do that? |
[2017-10-31 03:30:02] |
CustomIndicators - Posts: 126 |
To set the persistent in, did you use sc.SetStudyPersistentIntFromChart()? There are get functions, and set functions. |
[2017-10-31 03:46:29] |
CustomIndicators - Posts: 126 |
For local persistent ints, you use: sc.GetPersistentInt(key); sc.SetPersistentInt(key, newValue); For ints on other charts, you use: sc.GetStudyPersistentIntFromChart(chartNumber, studyID, key); sc.SetStudyPersistentIntFromChart(chartNumber, studyID, key, newValue); To get a subgraph from another chart, use: SCFloatArray StudyReference; sc.GetStudyArrayFromChartUsingID(chartNumber, targetChartStudyID, subgraphNumber, StudyReference); float oscValue0 = StudyReference[StudyReference.GetArraySize() - 1]; That stores the current value of the subgraph into oscValue0. If you wanted the last locked value, you just increase that number 1 to number 2. |
To post a message in this thread, you need to log in with your Sierra Chart account: