I am using the OnMarketData() function as follows:
protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Last)
{
int volume = e.Volume;
if (GetCurrentBid() == e.Price)
{
// trade was at the bid
volume *= -1;
}
if ((e.Volume >= smallSize) &&
(e.Volume <= largeSize))
{
volumeDelta += volume;
}
}
}
This seems to work OK, except for one time when I saw a positive trade go through and got booked as a negative trade. What I am wondering is if the GetCurrentBid() function is really the best way to be determining if the trade was executed at the bid or the ask. Is there a better/more reliable way to do this? Thanks!
Comment