I would like to measure the trading range for the past 2 hours. Now i'm struggling with the DateTime constructor to get the start time from now (last candle in chart, no historical stuff), 2 hours back.
DateTime startDateTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, (DateTime.Now.Hour - 2) , DateTime.Now.Minute, 0);
DateTime endDateTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0);
int startBarsAgo = Bars.GetBar(startDateTime);
int endBarsAgo = Bars.GetBar(endDateTime);
Thanks for your help...
Comment