I get the following error message by the attached strategy aa01OnOrderUpdate, derived from strategy SampleOnOrderUpdate posted on the help on line:
“Strategy 'aa01OnOrderUpdate': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.” and it does not trigger any trade.
I do not understand why the BarsRequiredToTrade = 20 set in the State.SetDefaults does not satisfy the minimum 5 bars requested mentioned in the error messages. Please could you help to solve this error message?
Thank you.
aa01OnOrderUpdate.zip
Comment