I am attempting to draw boxes for testing so that I may have a visual representation. When a level II level is updated I want a new box to print on the chart.
protected override void OnMarketDepth(MarketDepthEventArgs e) { // Print some data to the Output window if (e.MarketDataType == MarketDataType.Ask && e.Operation == Operation.Update) { Print("The most recent ask change is " + e.Price + " " + e.Volume + " " + e.Position); ISquare square = DrawSquare("tag1", false, 0, e.Price, Color.Red); } if (e.MarketDataType == MarketDataType.Bid && e.Operation == Operation.Update) { Print("The most recent bid change is " + e.Price + " " + e.Volume + " " + e.Position); ISquare square = DrawSquare("tag1", false, 0, e.Price, Color.Red); } }
The most recent bid change is 2710.75 5 0
The most recent bid change is 2710.5 43 1
The most recent ask change is 2711 37 0
Error on calling 'OnMarketDepth' method for indicator 'MarketDepthMap': MarketDepthMap.DrawSquare: bar out of valid range 0 through -1, was 0.
Also, how can I specify position in the orderbook? -9 would be 9 levels down in the bid, while 9 is 9 levels above market on the ask?
Comment