Anyone know why this indicator code without compile error, but execute has error of System.NullReferenceException?
using System;
using System.Drawing;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
[SameAsSymbol(true)]
public class Channel_Breakout : IndicatorObject
{
private HighestFC m_HighestFC;
private LowestFC m_LowestFC;
private IPlotObject Plot1;
private IPlotObject Plot2;
public Channel_Breakout(object ctx) :
base(ctx){
length = 20;
}
private ISeries<double> Price { get; set; }
[Input]
public int length { get; set; }
protected override void Create(){
m_HighestFC = new HighestFC(this);
m_LowestFC = new LowestFC(this);
Plot1 =
AddPlot(new PlotAttributes("UpperBand", 0, Color.Yellow,
Color.Empty, 0, 0, true));
Plot2 =
AddPlot(new PlotAttributes("LowerBand", 0, Color.Blue,
Color.Empty, 0, 0, true));
}
protected override void StartCalc(){
Price = Bars.High;
m_HighestFC.pricevalue = Price;
m_HighestFC.len = length;
}
protected override void CalcBar(){
var upperband = m_HighestFC[0];
var lowerband = m_LowestFC[0];
Plot1.Set(0, upperband);
Plot2.Set(0, lowerband);
}
}
}