Should this still be the case with MC.Net? I've been playing around with the AverageFC function, and noticed some odd behavior.
Specifically, if the code calls "m_averagefc1[0]" just once per bar and caches the result in a variable, then the code gives the correct result:
Code: Select all
protected override void CalcBar(){
m_avg.Value = m_averagefc1[0];
Output.WriteLine("{0}, {1}", Bars.Time[0], m_avg.Value);
Plot1.Set(displace, m_avg.Value);
}
Code: Select all
protected override void CalcBar(){
Output.WriteLine("{0}, {1}", Bars.Time[0], m_averagefc1[0]);
Plot1.Set(displace, m_averagefc1[0]);
}
Is this expected behavior, or a bug? Either way, is it possible to get the results of a function (like AverageFC) multiple times in a bar, without it affecting the results? I'd prefer to avoid creating additional "cache" variables unless necessary, since it makes the code longer and more complex.