the following error message is written into to the control center log (category 'Default') in conjunction with market replay:
Error on plotting last value for indicator 'MACD'. Please check the 'OnBarUpdate' method: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I use a strategy with the following contents:
[FONT=Courier New][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New] Initialize()[/FONT][/SIZE] [SIZE=2][FONT=Courier New]{[/FONT][/SIZE] [SIZE=2][FONT=Courier New]Add(MACD([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New]));[/FONT][/SIZE] [SIZE=2][FONT=Courier New]CalculateOnBarClose = [/FONT][/SIZE][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][SIZE=2][FONT=Courier New];[/FONT][/SIZE] [SIZE=2][FONT=Courier New]}[/FONT][/SIZE] [FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New] OnBarUpdate()[/FONT][/SIZE] [SIZE=2][FONT=Courier New]{[/FONT][/SIZE] [FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (CurrentBar <= [/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New];[/FONT][/SIZE] [SIZE=2][FONT=Courier New]}[/FONT][/SIZE] [/FONT]
Following steps are done:
- Start replay connection (recorded some hours of tick data in advance).
- Open a new 150-tick-chart and apply this test stratey
- Start replay with speed 100x and wait until the MACD starts to operate
- Stop replay
- Drag the replay slider back into its initial position, this is causing that error message. At the next run the MACD doesn't show up anymore.
Regards
Ralph
Comment