I am using the code below to get the price value of a 'user drawn' horizontal line on a chart. It seems to work okay on a blank chart (i.e. gets the correct price value). However, when I tried it on the chart I actually want to use it on, it comes up with the wrong price value, actually stuck on some arbitrary value from no where. The chart has got other indicators on it that plot lines like the current day low/high etc, but none of these lines are 'user drawn' (i.e. not drawn manually by myself). I wonder whether some how, these indicators' plotted lines are affecting my code below that's meant to get values from 'user drawn' lines only. If that's the case, how can I circumvent this please, is there a code I could further add to sort of identify/specify the horizontal line I want the y value (price) obtained from?
Many thanks
Dan
protected override void OnStartUp() { foreach (IDrawObject draw in DrawObjects) { if (draw.DrawType == DrawType.HorizontalLine && draw.UserDrawn) { IHorizontalLine hLine = (IHorizontalLine) draw; yvalue = Math.Round(hLine.Y, 2); // This is Price value } DrawTextFixed("Price","Price is " + yvalue, TextPosition.BottomLeft); } }
Comment