I need your help! I want to draw an object which uses the volume as a param.
I use protected override void OnMarketData(MarketDataEventArgs e) statement to get real-time volume and public override void Plot(..) statement to draw and fill a rectangle.
protected override void OnMarketData(MarketDataEventArgs e) { if (CurrentBar < 0) return; if (e.MarketDataType == MarketDataType.Bid){ BidPrices[0] = e.Price; } else if (e.MarketDataType == MarketDataType.Ask){ AskPrices[0] = e.Price; } vol=e.Volume; Print(“OMD vol: “+vol); } public override void Plot(Graphics graphics, Rectangle bounds, double min, double max) { Print(“Plot vol: “+vol); graphics.DrawRectangle(myPen,ChartControl.Right-225, y1,100, 16); graphics.FillRectangle(myBrush, ChartControl.Right-225, y1, vol, 16); }
The results are here:
OMD vol: 3 Plot vol: 3
OMD vol: 3
OMD vol: 1
OMD vol: 1 Plot vol: 1
OMD vol: 1 Plot vol: 1
OMD vol: 3
Comment