Sierra Chart | Sharing Data

Sierra Chart | Sharing data between studies in Sierra Chart

A common task when programming studies is this:

  1. You have two studies, StudyA and StudyB
  2. StudyA computes some data which you need to access in StudyB
  3. StudyA and StudyB might be on the same chart, might be on different charts with the same timeframe or they might be on different charts with different timeframes. They might also be on charts with different symbols.

There are basically two ways to go about this. Which one to use depends on the type of data you need to share between charts/studies.

The first method is good if your data is time series or you have an array of data. In this case you store your data in a subgraph on one chart/study and reference that data from a second study using methods such as sc.GetStudyArrayFromChart(). Sierra Chart provides a family of similar methods for referencing subgraphs between studies; which one to use depends on specific circumstances but they are all basically the same:

  1. You provide as input the chart ID, Study ID and Subgraph ID you want to reference
  2. You provide an ouput array that Sierra Chart will populate with data
  3. Through the output array, you can access the data as you would with any array

The second method involves using persistant varaibles. You define persitent variables in one study and use the method below to retrieve them in a second study. This is mostly good when the data shared is one dimensional – i.e., you need to share an number, a string, a date, etc.
sc.GetStudyPersistentVariablesFromChartUsingID()

All of this can be found on this page: http://www.sierrachart.com/index.php?l=doc/doc_ACSIL_Members.html