I'm modifying my own indicator, I need to use the last-tick price and last-tick volume in OnBarUpdate method.
I already know that I can use the Close[0] for the last-tick price, however I don't know how to get the volume. I also don't know how to get those variables (price and volume) with historical data.
I need to use price and volume for every incoming tick, therefore I'm using COBC = false
Code:
... OnBarUpdate()
{
if (Historical)
{
myMethod( price?, volume?); //For every tick in the bar not only the last one
}
myMethod( Close[0], volume?);
}
I was using OnMarketData method in my indicator and it works well, but now I need the indicator working with historical data so I assume I should use OnBarUpdate.
... OnMarketData(MaketDataEventArgs e)
{
if(e.MarketDataType == MarketDataType.Last)
{
myLastVolume = e.Volume;
myLastPrice = e.Price;
}
}
Cheers,
Ronald
Comment