Login Page - Create Account

Support Board


Date/Time: Tue, 24 Jun 2025 00:27:07 +0000



Post From: ACSIL Renko Open Close

[2022-02-09 23:51:02]
1+1=10 - Posts: 270
Hi, I'm a fellow user that codes in ACSIL a lot.

1. "SCSubgraphRef" is a type like "int". You use it when you declare the Subgraph variables but not when you assign to them later in the study. See below.
2. You're confused about how to reference the data in an array whether you're using manual looping or automatic looping. See the example code below but it would be helpful to reread this: Working with ACSIL Arrays and Understanding Looping


SCSubgraphRef Subgraph_Renko_PriorOpen = sc.Subgraph[0];
SCSubgraphRef Subgraph_Renko_PriorClose = sc.Subgraph[1];
SCSubgraphRef Subgraph_Renko_Open = sc.Subgraph[2];
SCSubgraphRef Subgraph_Renko_Close = sc.Subgraph[3];

if(sc.SetDefaults)
{
// You would have the typical set-up code here
sc.Autoloop = true;
// NOTE: working with automatic looping is easier but in the link above you
// can see how to do manually looping correctly

}
NOTE: When you place a study on chart or recalculate it your study is called once for every bar before the last one. 'sc.Index' refers to the current bar that the study is processing. It starts at the first bar on the chart, bar 0, and increments all the way up to the last bar in the chart. Thus, if at every bar in the chart you want to refer to the previous bar you do sc.Index - 1. ... The check below is necessary because when sc.Index is 0, sc.Index - 1 == -1 which will be out of bounds for the sc.BaseData arrays.

if (sc.Index >= 1)
{
Subgraph_Renko_PriorOpen[sc.Index] = sc.BaseData[SC_RENKO_OPEN][sc.Index - 1];
Subgraph_Renko_PriorClose[sc.Index] = sc.BaseData[SC_RENKO_CLOSE][sc.Index - 1];
Subgraph_Renko_Open[sc.Index] = sc.BaseData[SC_RENKO_OPEN][sc.Index];
Subgraph_Renko_Close[sc.Index] = sc.BaseData[SC_RENKO_CLOSE][sc.Index];
}