- A few requests on MT4
- [ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4.
- Values along a Trendline
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](https://c.mql5.com/36/70/how-to-get-prices-of-a-trendline.jpg)
- 2022.07.12
- www.mql5.com
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](https://c.mql5.com/36/70/documentation-on-mql5-matrix-and.png)
- www.mql5.com
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?
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](https://c.mql5.com/36/70/documentation-on-mql5-object-functions.png)
- www.mql5.com
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use