protected override void OnMarketData(MarketDataEventArgs data)
{
if (data.MarketDataType == MarketDataType.Last)
{
if (data.Last >= data.Ask)
{
buys += data.Volume;
if (State == State.Historical)
Print(string.Format("buys {0} {1} {2}", data.Last, data.Bid, data.Ask));
}
if (data.Last <= data.Bid)
{
sells += data.Volume;
if (State == State.Historical)
Print(string.Format("sells {0} {1} {2}", data.Last, data.Bid, data.Ask));
}
}
}
The problem appears to be with data.Last. The data.Bid and data.Ask values appear to be appropriate, but data.Last sticks on values outside the bid/ask range for large periods of time. Here is an example from the print output:
sells 4576.5 4578.75 4579
sells 4576.5 4578.5 4578.75
sells 4576.5 4578.5 4578.75
sells 4576.5 4578.5 4578.75
sells 4576.5 4578.75 4579
sells 4576.5 4578.75 4579
sells 4576.5 4578.75 4579
sells 4576.5 4578.75 4579
sells 4576.5 4578.75 4579
Any ideas or suggestions would be greatly appreciated.

Comment