Support Board
Date/Time: Mon, 23 Jun 2025 19:21:40 +0000
Post From: How to access future price data(in the downloaded dataset) in a study
[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]; } } |