On a simple 5-min bar chart with 60 days, there are about 6000 bars. With this code, MaxBarsBack will be around 1940 :
Code: Select all
protected override void StartCalc() {
// assign inputs
}
protected override void CalcBar()
{
plot1.Set(Bars.Close[1200]);
if (Bars.LastBarOnChart)
{
Output.WriteLine("MaxBarsBack: {0}", ExecInfo.MaxBarsBack); // 1941
}
}
Now, I add a daily data stream for same instrument, with the same numbers of days (60). The remaining of the code is the same :
Code: Select all
protected override void StartCalc()
{
dsDaily = BarsOfData(3); // BarsOfData(3) is the daily bar instrument
}
protected override void CalcBar()
{
plot1.Set(Bars.Close[1200]);
if (Bars.LastBarOnChart)
{
Output.WriteLine("MaxBarsBack: {0}", ExecInfo.MaxBarsBack); // "Calculating..."
}
}
So there are 6000 5-min bars, and MaxBarsBack prevents me to go beyond the 56th. That does not cover a single session !...
Is there something to change this behavior ? Because at the moment, this makes all the code that relies on a MaxBarsBack of around 1940 unusable. What comes naturally to the mind is that each data stream should have their own MaxBarsBack value. In this example, MaxBarsBack for the daily data stream should probably be 1. But above all, that should not affect the MaxBarsBack of the main data stream. It makes no sense to apply a MaxBarsBack value calculated on a 5-min series to a daily series. Or is there another solution to this problem ?
Regards.