I have a piece of code It is giving an Error: Error on calling 'OnBarUpdate' method for strategy 'CDCandle/0a84bcadcad749288376ff725280a69d': Object reference not set to an instance of an object.
protected override void Initialize()
{
CalculateOnBarClose = true;
Add(PeriodType.Minute,30);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if(CDMA(BarsArray[1],true, GomCDCalculationModeType.BidAsk, GomCDChartType.CumulativeChart, Color.Bisque, "Alert2.wav", false, 14, 3, 0.7, Color.Honeydew, "Alert1.wav", 1000000, 1).DeltaOpen[0] == null
|| CDMA(true, GomCDCalculationModeType.BidAsk, GomCDChartType.CumulativeChart, Color.Bisque, "Alert2.wav", false, 14, 3, 0.7, Color.Honeydew, "Alert1.wav", 1000000, 1).DeltaClose[0] == null
||Close[0] == null
|| Opens[1][0]== null
)
{
return;
}
else
{
// Condition set 1
if (CDMA(true, GomCDCalculationModeType.BidAsk, GomCDChartType.CumulativeChart, Color.Bisque, "Alert2.wav", false, 14, 3, 0.7, Color.Honeydew, "Alert1.wav", 1000000, 1).DeltaClose[0] > CDMA(BarsArray[1],true, GomCDCalculationModeType.BidAsk, GomCDChartType.CumulativeChart, Color.Bisque, "Alert2.wav", false, 14, 3, 0.7, Color.Honeydew, "Alert1.wav", 1000000, 1).DeltaOpen[0]
&& Close[0] > Opens[1][0]
)
{
EnterLong(DefaultQuantity, "");
}
}
Can you please tell what is wrong with the code, I beleive I might have missed some null exception. But, can't find where
Comment