I am coding a Strategy that runs a loop over part of the loaded historical data in State.Transition. I put this code here since it only needs to be run once prior to going to live data.
I have successfully tested this code in an Indicator, but I am getting an index out of range error when I try this in a Strategy (chart). The code checks to make sure there are sufficient bars before attempting the loop.
It works OK if I stick to the default value (as set in State.Defaults) for the loopback period, but if I then edit the Strategy settings and change this value to any other value and then try to enable the Strategy again, I get the standard index out of range error message.
EDIT: I just tried to put the loop code in OnBarUpdate() - same behaviour as above.
Comment