bani789
06-12-2008, 01:44 PM
Hello, I'm trying to compare 2 values using Bars.GetSessionBar in an if statement under OnBarUpdate(), example being as follows:
protected override void OnBarUpdate()
{if (Bars.GetSessionBar(1).Close < Bars.GetSessionBar(1).Open){EnterLong();}
}
When backtesting that section of code I get the following error in the log: "Error on calling 'OnBarUpdate' method for strategy 'Strategy2': Object reference not set to an instance of an object."
The entries however still seem to be taken regardless of the error, so I'm not sure whether it's causing any real problems. Any help would be appreciated.
protected override void OnBarUpdate()
{if (Bars.GetSessionBar(1).Close < Bars.GetSessionBar(1).Open){EnterLong();}
}
When backtesting that section of code I get the following error in the log: "Error on calling 'OnBarUpdate' method for strategy 'Strategy2': Object reference not set to an instance of an object."
The entries however still seem to be taken regardless of the error, so I'm not sure whether it's causing any real problems. Any help would be appreciated.