Hi
I create a trend line by following code:
then take value of Object in a specific time by this command:
then print it in Journal. But when I hover the pointer on the chart, trendLine value is different from value printed in journal.
For example, at 2020.12.24 09:00:00 on chart, it's 1.22347 but in journal it's 1.21980.
this Difference is not constant and doesn't follow a defined rule.
.
I appreciate your help.
Use a horizontal line. The trend line is still a very difficult object for you.
My algorithm is based on trends. Is there another function to take TrendLine's value by, instead of
?
What exactly do you need? If you draw an inclined line (the trend line is just an inclined line), then the price will naturally change from the initial point to the final one.
See the help: ObjectGetValueByTime
Return Value
The price value for the specified time value of the specified object.
![Documentation on MQL5: Object Functions / ObjectGetValueByTime Documentation on MQL5: Object Functions / ObjectGetValueByTime](https://c.mql5.com/36/43/documentation-on-mql5-object-functions__1.png)
- www.mql5.com
What exactly do you need? If you draw an inclined line (the trend line is just an inclined line), then the price will naturally change from the initial point to the final one.
See the help: ObjectGetValueByTime
Return Value
The price value for the specified time value of the specified object.
I use the trend (or, inclined line) as a support/resistance price. I first select two Maximum points on chart then draw a line between them and continue that line to about one week later.
As I use this inclined Line as resistance(or support), want to get it's current value. But what I see in chart and in journal is different.
I've shown this in attached JPG.
I use the trend (or, inclined line) as a support/resistance price. I first select two Maximum points on chart then draw a line between them and continue that line to about one week later.
As I use this inclined Line as resistance(or support), want to get it's current value. But what I see in chart and in journal is different.
I've shown this in attached JPG.
You don't need to use a trand line - you don't understand how to work with it. The ObjectGetValueByTime function returns the PRICE at a point in time
datetime time, // Time
Now look at what you are doing: you get the price at the time of TimeCurrent (), and place the mouse cursor somewhere in the middle of the chart.
TimeCurrent () ! = In the middle of the chart.
![Documentation on MQL5: Object Functions / ObjectGetValueByTime Documentation on MQL5: Object Functions / ObjectGetValueByTime](https://c.mql5.com/36/43/documentation-on-mql5-object-functions__2.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
In MT5, I create a trend line by following code:
then take value of Object in a specific time by this command:
then print it in Journal. But when I hover the pointer on the chart, trendLine value is different from value printed in journal.
For example, at 2020.12.24 09:00:00 on chart, it's 1.22347 but in journal it's 1.21980.
this Difference is not constant and doesn't follow a defined rule.
.
I appreciate your help.