Get/retrieve Horizontal line Object name with a known price level

Created at 19 Nov 2022, 01:49
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!
WI

Willie_Dladla

Joined 15.05.2020

Get/retrieve Horizontal line Object name with a known price level
19 Nov 2022, 01:49


Hello Guys,

Can you please assist, I'm currently using the below code to find/get the price of the max/highest Horizontal line on chart:

Var lines = Chart.FindAllObjects<ChartHorizontalLine>();

foreach(var line in lines)

{

double Max_Line_Price = lines.max( x => x.Y);

}

I want to get the string Name of the same/specific line, how can i retrieve it?

 

String Max_Line_Name = ?


@Willie_Dladla
Replies

PanagiotisChar
21 Nov 2022, 08:48

Hi there,

Try this

var lineName = lines.OrderByDescending(l => l.Y).First().Name;

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

Willie_Dladla
23 Nov 2022, 21:19

RE:

PanagiotisChar said:

Hi there,

Try this

var lineName = lines.OrderByDescending(l => l.Y).First().Name;

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Thank you PanagiotisChar I appreciated it.


@Willie_Dladla