i´d like to add an requirement to my automated trading strategy.
I like to add a filter - to trade only days, where the close of one day ago was higher then the close of two days ago.
I tryed to implement it this way:
protected override void OnBarUpdate()
....
if ( Bars.GetDayBar(1).Close > Bars.GetDayBar(2).Close && the other requirements)
before adding this filter, everything worked fine. but after adding this filter i get the message:
Error on calling 'OnBarUpdate' method for stratgy xy
-when enableling the strategy.
It would be great if you could give me a hint how to solve the problem.
Thank You !
Comment