Find current value of non-horizontal line

 

Hi all

Hopefully an easy for the programmers out there but something I cannot figure out. 

I want to be able to manually draw a non-horizontal trend line on a chart and then use the value of that line that corresponds to the current time.

For example, a line is drawn below a typical flag setup and named "MyLine". I want to know the value of the line at the current time so that I can write an EA to sell when the price closes below that value. 

This code returns a 0:

LowerLine = ObjectGet(MyLine, OBJPROP_PRICE);

This code returns the start price of the line:

LowerLine = ObjectGet(MyLine, OBJPROP_PRICE1);

This code returns the end price of the line:

LowerLine = ObjectGet(MyLine, OBJPROP_PRICE2);

How do I return the current price of the line?

Regards,

Krooza

 
   double current_value = ObjectGetValueByShift(MyLine,0);
 
 
honest_knave:
 

You are brilliant. Thanks!
Reason: