Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator{
public class canc : IndicatorObject {
public canc(object _ctx):base(_ctx)
{
Contabarre=3;
}
[Input]
public int Contabarre { get; set; }
private IPlotObject plot1;
private Function.CANC_ Test;
private int Flag=0;
protected override void Create() {
// create variable objects, function objects, plot objects etc.
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
Test = new Function.CANC_(this);
}
protected override void StartCalc() {
// assign inputs
Test.contabarre = Contabarre;
}
protected override void CalcBar(){
// indicator logic
}
}
}
using System;
using System.Drawing;
using System.Linq;
namespace PowerLanguage
{
namespace Function
{
public sealed class CANC_ : FunctionSeries<System.Int32>
{
public CANC_(CStudyControl _master) : base(_master) { }
public CANC_(CStudyControl _master, int _ds) : base(_master, _ds) { }
public int contabarre { get; set; }
......
.....
protected override void StartCalc()
{
// assign inputs
}
protected override System.Int32 CalcBar()
{
Output.WriteLine("OUT CICLO ** bars {0}" , Bars.CurrentBar );
....
....
}
OUT CICLO ** bars 1
OUT CICLO ** bars 1
OUT CICLO ** bars 2
OUT CICLO ** bars 3
OUT CICLO ** bars 4
OUT CICLO ** bars 5
OUT CICLO ** bars 1
OUT CICLO ** bars 2
OUT CICLO ** bars 3
OUT CICLO ** bars 4
OUT CICLO ** bars 5
OUT CICLO ** bars 6
OUT CICLO ** bars 7
OUT CICLO ** bars 8
OUT CICLO ** bars 9
OUT CICLO ** bars 10
OUT CICLO ** bars 11
OUT CICLO ** bars 12
OUT CICLO ** bars 13
OUT CICLO ** bars 14
OUT CICLO ** bars 15
OUT CICLO ** bars 16
OUT CICLO ** bars 17
OUT CICLO ** bars 18
OUT CICLO ** bars 19
OUT CICLO ** bars 20
OUT CICLO ** bars 21
OUT CICLO ** bars 22
OUT CICLO ** bars 23
OUT CICLO ** bars 24
OUT CICLO ** bars 25
OUT CICLO ** bars 1 ================> WHY? count of the bars will reset after a certain number
OUT CICLO ** bars 2
OUT CICLO ** bars 3
OUT CICLO ** bars 4
OUT CICLO ** bars 5
OUT CICLO ** bars 6
OUT CICLO ** bars 7
OUT CICLO ** bars 8
OUT CICLO ** bars 9
PROBLEM : the count of the bars will reset after a certain number
(if I remember right .. this was the problem in the first versions in powerlanguage (not mc.net), then the problem was solved