- 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.
- 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)
- 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)
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use