CT
Locate text above horizontal line
12 Apr 2018, 09:50
Hi, i have a horizontal line that follows a changing stoploss. I would like to include text that will appear above the right hand end of the line, and remain a constant distance above it when the line is redrawn. I am confused about the xPos and yPos parameters. Here is the code that I am using.
ChartObjects.DrawHorizontalLine("LongTargetLine", _longtarget, Colors.Lime, 1, LineStyle.Lines);
ChartObjects.DrawText("LongText", "Long Target", xPos, yPos, vAlign, hAlign, Colors.Lime);
I'm assuming that the yPos should follow the _longtarget parameter, but I can't figure ot the xPos part. No issues with vAlign and hAlign.
Can anybody help, please ...

PanagiotisCharalampous
12 Apr 2018, 09:55
Dear Trader,
Thanks for posting in our forum. See below an example
var index = MarketSeries.Low.Count - 1; var low = MarketSeries.Low[index]; var text = low.ToString(); var xPos = index; var yPos = low; var vAlign = VerticalAlignment.Bottom; var hAlign = HorizontalAlignment.Right; ChartObjects.DrawHorizontalLine("LongTargetLine", low, Colors.Lime, 1, LineStyle.Lines); ChartObjects.DrawText("LongText", "Long Target", xPos, yPos, vAlign, hAlign, Colors.Lime);You can adjust it based on your parameters
Best Regards,
Panagiotis
@PanagiotisCharalampous