Joerg
05-31-2010, 07:00 AM
Hello,
the following example for working with dataseries I copied from the sample reference of this forum.
protected override void Initialize()
{
Add(new Plot(Color.Orange, PlotStyle.Bar, "Average Range"));
myDataSeries = new DataSeries(this);
CalculateOnBarClose = true;
Overlay = false;
}
protected override void OnBarUpdate()
{
myDataSeries.Set(Math.Abs(Close[0] - Open[0]));
AvgR.Set(SMA(myDataSeries, Period)[0]);
}
Is my understanding right, that the Period of the SMA of the myDataSeries references to the BarArray? So if I am working on a 1-Min-Bar Chart and Period of this SMA is 20, it is calculated for the last 20 Minutes?
What I like to do is: create a dataseries, add data into it at some bars (and some bars not, irregularely) and then use this datseries in SMA-function. And SMA should use last 20 entries of the dataseries and not last 20 Minutes.
How should I change the example above for that aim?
Thanks a lot.
Joerg
the following example for working with dataseries I copied from the sample reference of this forum.
protected override void Initialize()
{
Add(new Plot(Color.Orange, PlotStyle.Bar, "Average Range"));
myDataSeries = new DataSeries(this);
CalculateOnBarClose = true;
Overlay = false;
}
protected override void OnBarUpdate()
{
myDataSeries.Set(Math.Abs(Close[0] - Open[0]));
AvgR.Set(SMA(myDataSeries, Period)[0]);
}
Is my understanding right, that the Period of the SMA of the myDataSeries references to the BarArray? So if I am working on a 1-Min-Bar Chart and Period of this SMA is 20, it is calculated for the last 20 Minutes?
What I like to do is: create a dataseries, add data into it at some bars (and some bars not, irregularely) and then use this datseries in SMA-function. And SMA should use last 20 entries of the dataseries and not last 20 Minutes.
How should I change the example above for that aim?
Thanks a lot.
Joerg