Login Page - Create Account

Support Board


Date/Time: Tue, 10 Jun 2025 21:51:11 +0000



[Programming Help] - Getting data from other timeframe chart when Bar is Closed

View Count: 491

[2022-11-10 19:45:41]
kam2001 - Posts: 87
Hi, I am using the the code below to get data from other chart (e.g 20 range bar chart), is it possible to get the last price data only when the bar is closed in other time frame chart ?

// The following code is for getting the High array
// and corresponding index from another chart.

// Define a graph data object to get all of the base graph data
SCGraphData BaseGraphData;

// Get the base graph data from the specified chart
sc.GetChartBaseData(ChartNumber.GetInt(), BaseGraphData);

// Define a reference to the High array
SCFloatArrayRef HighArray = BaseGraphData[SC_HIGH];

// Array is empty. Nothing to do.
if(HighArray.GetArraySize() == 0)

return;
[2022-11-10 20:03:35]
User431178 - Posts: 703
Compare other chart index and arraysize, if index < arraysize - 1, bar is closed.
Obviously arraysize in this case means the other chart array.
[2022-11-10 20:32:07]
kam2001 - Posts: 87
sorry, you mean something like this, i am not sure how to get the index of other chart


SCGraphData BaseData;
sc.GetChartBaseData(1, BaseData);
int lastElementIndex = BaseData[SC_LAST].GetArraySize() - 1;

if(BaseData[sc.Index] < lastElementIndex){
SCString cBuffer;
cBuffer.Format("CLOSED - Last Price %f", BaseData[SC_LAST][lastElementIndex]);
sc.AddMessageToLog(cBuffer, 0);
}

[2022-11-12 21:14:03]
OctoPi - Posts: 41
Our backtesting tool gets you info from any bar of any chart for different time-frame or other logical verification of your strategy.
We are still in beta-test mode, but reach out if you are interested in trial-running it.

https://www.youtube.com/channel/UCjSpDQ7ZhrHjgKNUP0PNm7w
Probably check out "Tutorial #6 - Execution" video to get to the point.
Tutorial #3 is where you would specify which chart you'd want bar info from. I don't cover different chart in the video but we can do it.

Shoot me an email if interested.
support@octopitechnologies.com

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

Login

Login Page - Create Account