**NT** Error on calling 'OnBarUpdate' method for strategy 'Long/18da4c7079bd424498f83d4a0daf6838': Object reference not set to an instance of an object.
I know the numbers are off next to the close, but can someone please help me get rid of this error? Right now I am strictly looking at placing orders off of the bar closures. Not trying to add SMA or anything else yet. Just a work in progress.
Thank you for your help
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (BarsInProgress == 0)
// Condition set 1
if (Close[-5] > Close[0]
&& Close[-5] > Close[-1])
{
EnterLong(1000, "entry1");
}
// Condition set 2
if (Close[-5] < Close[0]
&& Close[-5] < Close[-1])
{
ExitLong("1000", "entry1");
}
}

Comment