Code: Select all
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator{
public class Prova__: IndicatorObject {
public Prova__(object _ctx):base(_ctx){}
private IPlotObject plot1;
private Function.ProvaCurrentBar3 Contabar;
protected override void Create() {
// create variable objects, function objects, plot objects etc.
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
Contabar = new Function.ProvaCurrentBar3(this);
}
protected override void StartCalc() {
// assign inputs
}
protected override void CalcBar(){
plot1.Set(Contabar.Value);
}
}
}
using System;
using System.Drawing;
using System.Linq;
Code: Select all
Code: Select all
{
namespace Function
{
public sealed class ProvaCurrentBar : FunctionSimple<System.Int32>
{
public ProvaCurrentBar(CStudyControl _master) : base(_master) { }
public ProvaCurrentBar(CStudyControl _master, int _ds) : base(_master, _ds) { }
private int m_current_bar ;
protected override int CalcBar(){
return ++m_current_bar;
}
protected override void StartCalc(){
m_current_bar = 0;
}
}
}
}
Code: Select all
the program starts counting from the bar 6 on ...( In the previous examples the calculation was correct)
why? thanks