Locate text above horizontal line

Created at 01 Oct 2018, 07:07
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
HO

hoabg102

Joined 01.10.2018

Locate text above horizontal line
01 Oct 2018, 07:07


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.

1 ChartObjects.DrawHorizontalLine("LongTargetLine", _longtarget, Colors.Lime, 1, LineStyle.Lines);

2 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 ...

Thanks. 


@hoabg102
Replies

hoabg102
07 Mar 2019, 05:22

bài hát


@hoabg102

PanagiotisCharalampous
07 Mar 2019, 09:35

Hi hoabg102,

Thanks for posting in our forum. The functions you use are obsolete. Please try the ones in the example below

            Chart.DrawHorizontalLine("LongTargetLine", Symbol.Bid + (Symbol.PipSize * 2), Color.Lime, 1, LineStyle.Lines);
            Chart.DrawText("LongText", "Long Target", Server.Time, Symbol.Bid + (Symbol.PipSize * 3), Color.Lime);

Best Regards,

Panagiotis


@PanagiotisCharalampous