Login Page - Create Account

Support Board


Date/Time: Mon, 23 Jun 2025 15:52:19 +0000



[Programming Help] - How to access future price data(in the downloaded dataset) in a study

View Count: 601

[2022-02-13 13:54:53]
User395175 - Posts: 90
Hi, is it possible to access future data when programming a study. For example, i want to get the mean of next 20 close prices in the history dataset.(assuming i already downloaded the next 20 close prices)
[2022-02-13 15:52:25]
Sierra Chart Engineering - Posts: 104368
This is not clear for us, but if the data is in the chart it is accessible. Refer to:
Working with ACSIL Arrays and Understanding Looping
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
[2022-02-13 17:39:56]
User395175 - Posts: 90
Thank you for answering it. Maybe i can use sc.Index+1, sc.Index+2.... to access future data on chart?
[2022-02-13 18:36:25]
Sierra Chart Engineering - Posts: 104368
No that does not make sense, but you can fill in Study Subgraph elements, into the extended / forward area of the chart. How this works is explained here:
ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].ExtendedArrayElementsToGraph
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
[2022-02-14 00:35:12]
1+1=10 - Posts: 270
is it possible to access future data when programming a study. For example, i want to get the mean of next 20 close prices in the history dataset.(assuming i already downloaded the next 20 close prices)

If the next 20 close prices are already downloaded then you just need manual looping which is explained in the link SCEngineering sent which has an example that I'll summarize:

// Loop through all the chart bars:
for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
{


// For each bar's 0 subgraph output the bar's high - low
sc.Subgraph[0][Index] = sc.BaseData[SC_HIGH][Index] - sc.BaseData[SC_LOW][Index];

// Make sure 20th bar into future exists
if (Index + 20 < sc.ArraySize)
{
// For each bar's 0 subgraph output the high of the 20th bar into the future.
sc.Subgraph[0][Index] = sc.BaseData[SC_HIGH][Index + 20];
}
}

[2022-02-14 12:10:19]
User395175 - Posts: 90
Thank you very much!
[2022-02-14 13:13:54]
1+1=10 - Posts: 270
Sure! Oh, obviously you can’t use the same subgraph to output two different data points so in the example they should not both be subgraph 0.

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

Login

Login Page - Create Account