I have a syntax below for me to get the Bars Ago using Time, I have multiple dataseries in the program. I am getting negative value for the barsAgo. How do I fix this?
DateTime convertedTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 30, 00);
int barsAgo = Bars.GetBars(convertedTime);
Additionally, getting BarNumber using below code works in 5 Minute Chart but not in my 1 Minute chart so I was trying above code. I am also getting negative value.
clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.Get Position(ChartControl as IInputElement).X, ChartControl.PresentationSource);
clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPo sition(ChartControl as IInputElement).Y, ChartControl.PresentationSource);
barsAgo = CurrentBars[0] - (int)ChartControl.GetSlotIndexByX((int)clickPoint. X);
Thanks

Comment