Create text label permanently aligned to a horizontal line regardless of scrolling or changing timeframes

Created at 13 Aug 2023, 17:53
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!
JO

joey.irosh.stuff

Joined 11.08.2023

Create text label permanently aligned to a horizontal line regardless of scrolling or changing timeframes
13 Aug 2023, 17:53


 Hi,

I am trying to create a text label that aligns to a horizontal line thats permanently aligned to the horizontal line regardless of whether
I scroll to the left or right or change timeframes.I assumed using function Chart.FirstVisibleBarIndex would work in code string 

 Chart.DrawHorizontalLine("test",22.9, Color.Yellow,4,LineStyle.Solid);
Chart.DrawText("text1", "22.9", Chart.FirstVisibleBarIndex ,22.9,Color.Yellow);

and the text 22.9 appears on the initial chart after executing the code but when I scroll the chart,the text disappears.Is there a function argument I can use to have the text permanently aligned to the left of the chart regardless of whether I scroll or change timeframes?

I havent coded in over 20 years and definitely I have never coded in ctrader or C# so please bear with me if my questions seem basic and not from much coding knowledge

Thanks


@joey.irosh.stuff