VolumeProfile.cs
if (Bars.IsTickReplay)
{
if (e.MarketDataType == MarketDataType.Last)
{
if (e.Price >= e.Ask)
askPrice = e.Price;
else if (e.Price <= e.Bid)
bidPrice = e.Price;
price = e.Price;
volume = e.Volume;
if (!cacheDictionary.ContainsKey(price))
cacheDictionary.Add(price, new VolumeInfoItem());
volumeInfoItem = cacheDictionary[price];
if (price >= askPrice)
volumeInfoItem.up += volume;
else if (price <= bidPrice)
volumeInfoItem.down += volume;
else
volumeInfoItem.neutral += volume;
}
} else
{
if (e.MarketDataType == MarketDataType.Ask)
{
askPrice = e.Price;
return;
}
if (e.MarketDataType == MarketDataType.Bid)
{
bidPrice = e.Price;
return;
}
BuySellVolume.cs
if(e.MarketDataType == MarketDataType.Last)
{
double tradeVol = previousVol == 0 ? e.Volume : e.Volume - previousVol;
if(e.Price >= e.Ask)
{
buys += tradeVol;
}
else if (e.Price <= e.Bid)
{
sells += tradeVol;
}
}

Comment