trendline value

 
Welcome everyone!
If you drag the mouse over it, a trend line is visible
you can see it in the small window that pops up with the mouse cursor

the price value of a specific point.
I want to pass this value to a variable.
How to read this value from the system

Hello! Thank you for your help
 
mqlbandi:
Welcome everyone!
If you drag the mouse over it, a trend line is visible
you can see it in the small window that pops up with the mouse cursor

the price value of a specific point.
I want to pass this value to a variable.
How to read this value from the system

Hello! Thank you for your help

i, also having the same issue as you, im not sure but you can check this topic in forum.

Also you may find more in the documentation, but i can't tell you for sure how to use it.

How to get prices of a trendline in mql5
How to get prices of a trendline in mql5
  • 2022.07.12
  • www.mql5.com
Please i need help, i have a simple trendline that draws a line from lowest low at a point to the current low of the most recent candle...
 
More precisely, the price value of the two lines of the trend channel should be read out and passed to a variable at the very last candle.
 

Do the math: https://en.wikipedia.org/wiki/Linear_equation

A (straight) trend line is defined by 2 values: x can be either time or the index number of the bar, and y values are prices. You have to find the a and b of y=a*x + b.

Here is the two point version: https://en.wikipedia.org/wiki/Linear_equation#Two-point_form

You can try to use solve from matrix calculation: https://www.mql5.com/en/docs/matrix/matrix_solves/matrix_solve (I haven't tried and checked it yet)

Documentation on MQL5: Matrix and Vector Methods / Solutions / Solve
Documentation on MQL5: Matrix and Vector Methods / Solutions / Solve
  • www.mql5.com
Solve - Solutions - Matrix and Vector Methods - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

How to parameterize this function

double  ObjectGetValueByTime(
   long      chart_id,     // chart identifier
   string    name,         // object name
   datetime  time,         // Time
   int       line_id       // Line number
   );

what is the line ID?

 
mqlbandi #: How to parameterize this function. what is the line ID?

You should read the documentation ... Documentation on MQL5: Object Functions / ObjectGetValueByTime

An object can have several values in one price coordinate, therefore it is necessary to specify the line number. This function applies only to the following objects:

  • Trendline (OBJ_TREND)
  • Trendline by angle (OBJ_TRENDBYANGLE)
  • Gann line (OBJ_GANNLINE)
  • Equidistant channel (OBJ_CHANNEL) - 2 lines
  • Linear regression channel (OBJ_REGRESSION) - 3 lines
  • Standard deviation channel (OBJ_STDDEVCHANNEL) - 3 lines
  • Arrowed line (OBJ_ARROWED_LINE)
Documentation on MQL5: Object Functions / ObjectGetValueByTime
Documentation on MQL5: Object Functions / ObjectGetValueByTime
  • www.mql5.com
ObjectGetValueByTime - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: