The class has 4 Series<T> objects - the two which are passed in and the refactored two refactored versions - so these would I hoped stay in sync with the indicator which has instantiated the class. I am pretty novice at coding.
namespace NinjaTrader.NinjaScript.AddOns
{
public class KtRelativeValueModule: IndicatorBase
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
}
else if (State == State.Configure)
{
//_anchorRefactoredArray = new Series<double>(this);
//_refRefactoredArray = new Series<double>(this);
//_anchorArray = new Series<double>(this);
//_refArray = new Series<double>(this);
}
}
private Indicator _ind = new Indicator();
private List<double> _anchorList = new List<double>(); // redondo
private List<double> _refList = new List<double>(); // redondo
private Series<double> _anchorArray;
private Series<double> _refArray;
private Series<double> _anchorRefactoredArray;
private Series<double> _refRefactoredArray;
//private TimeSpan _timeSpan = new TimeSpan(0);
private int _endBarsAgo;
private int _startBarsAgo;
private DateTime _startTime = new DateTime(0);
private const int Granularity = 1000;
private double _aMin, _aMax, _aUnits, _aRange, _refMin, _refMax, _refUnits, _refRange;
private int _barCount;
private bool _newBar;
public KtRelativeValueModule()
{
_anchorArray = new Series<double>(thisIndicator);
_refArray = new Series<double>(thisIndicator);
_anchorRefactoredArray = new Series<double>(thisIndicator);
_refRefactoredArray = new Series<double>(thisIndicator);
_barCount = Bars.Count;
_endBarsAgo = 0;
}
public KtRelativeValueModule(Series<double> anchorArray, Series<double> referenceArray) : this()
{
_anchorArray = anchorArray;
_refArray = referenceArray;
_barCount = Bars.Count;
SetTheScene();
}

Comment