I am trying to get last 1 min bar using GetBar function. I am using following piece of code for this purpose but it returns me all the bars during that day.
For example if
startDate = 2/12/2014 3:00:00
endDate = 2/12/2014 3:01:00
It returns all 1 min bars for 2/12/2014.
public Bars GetCurrentBar(string instrument, int period, DateTime startDate, DateTime endDate) { Bars newBars = Data.Bars.GetBars(Cbi.Instrument.GetObject(instrument), new Period(PeriodType.Minute, period, MarketDataType.Last), startDate, endDate, Data.Bars.GetSession(Instrument, ""), Data.Bars.SplitAdjust, Data.Bars.DividendAdjust); return newBars; }
Thanks,
Comment