Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 07:28:07 +0000



Post From: ACSIL for automating price expansion tool with float array from study

[2023-12-30 12:17:28]
User431178 - Posts: 541
1. You need a separate array for each of lows and highs, powerRange would only contain data relating to the second call of sc.GetStudyArrayFromChartUsingID.


SCFloatArray powerRangeHigh;
SCFloatArray powerRangeLow;

sc.GetStudyArrayFromChartUsingID(i_RangeHigh.GetChartStudySubgraphValues(), powerRangeHigh);
sc.GetStudyArrayFromChartUsingID(i_RangeLow.GetChartStudySubgraphValues(), powerRangeLow);


2. You need to identify the index where you wish to draw / access values from.
As you seem to be drawing only once, during reclaculation, maybe use sc.ArraySize - 1 for the index value, in other words the most recent bar.

The code below does not make sense and is the source of the error message you quoted.


float BarIndex = powerRange;

Instead you could use something like below


Tool.BeginIndex = sc.ArraySize - 1;
Tool.EndIndex = Tool.BeginIndex
Tool.BeginValue = powerRangeHigh[sc.ArraySize - 1];
Tool.EndValue = powerRangeLow[sc.ArraySize - 1];


3. If you are getting values from another chart, as might be implied by the use of 'sc.GetStudyArrayFromChartUsingID', then using sc.ArraySize - 1 (as shown above) would not be correct.
Instead you would need to find the corresponding index on the referenced chart - see following link for details - Referencing Other Time Frames and Symbols When Using the ACSIL

Once you have the corresponding other chart index, the snip from 2. would be rewritten as below


Tool.BeginIndex = sc.ArraySize - 1;
Tool.EndIndex = Tool.BeginIndex
Tool.BeginValue = powerRangeHigh[otherChartIndex];
Tool.EndValue = powerRangeLow[otherChartIndex];