Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 14:12:58 +0000



Post From: ACSIL - sc.GetStudyArraysFromChartUsingID for Donchian Channel

[2020-09-23 17:22:53]
MattK - Posts: 42
Hi,

I can't figure something out :(
I'm used to sc.GetStudyArraysFromChartUsingID when crossing symbols to extract a simple moving average but this time I'd like to get the lowest value using a Donchian Channel study.

The following code is the one I use when extracting the moving average. How can I change it to get the lowest low from a Donchian Channel study?

I think the problem I have is that the study is not returning a single value like a SMA does and I don't know how to deal with that.

Many thanks in advance.


SCGraphData BaseGraphData;
sc.GetChartBaseData(3, BaseGraphData);
SCFloatArrayRef ChartZFPrice = BaseGraphData[SC_LAST];
int RefChartIndex = sc.GetExactMatchForSCDateTime(3, sc.BaseDateTimeIn[sc.Index]);
float ExactChartZFPrice = ChartZFPrice[RefChartIndex];
  
SCGraphData StudyData;
int RefChartIndex2 = sc.GetExactMatchForSCDateTime(3, sc.BaseDateTimeIn[sc.Index]);

// THIS IS THE STUDY PART WHERE THE MAGIC IS NOT HAPPENING YET. THIS ONE IS FOR A SMA AND I WANT TO GET THE LOWEST LOW FROM A DONCHIAN CHANNEL STUDY
sc.GetStudyArraysFromChartUsingID(3, 1, StudyData);
SCFloatArrayRef ImportedMAZF = StudyData[0];
float ExactImportedMAZF = ImportedMAZF[RefChartIndex2];

Date Time Of Last Edit: 2020-09-23 17:39:09