Topic to discuss: how to retrieve in a strategy the volume per price from the SampleLevel2Book indicator
I have tried the following to get the bid for the first row:
*code written when declaring variables
private SampleLevel2Book SampleLevel2Book1;
*code written under “State == State.DataLoaded”:
SampleLevel2Book1=SampleLevel2Book(Close);
*code written under ”OnbarUpdate()”
bid1=SampleLevel2Book1.bidRows[1].Volume;
I then use bid1 in a condition to trigger buy/sell orders
When i compile the strategy there are no errors, however when launching the strategy i get the following error: “Error on calling “OnBarUpdate method on bar 1: you are accessing an index with a value that is invalid since it is out of range”
Am i using the indicator correctly?

Comment