- "Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
- Is your object a trendline (or one of the other types listed at ObjectGetTimeByValue - Object Functions - MQL4 Reference)?
- Does it actually pass through the value one?
- Are you sure you want to add 6.083 hours?
The object is a vertical line. My understanding was that it would get the time value at price level one of my object. But now I’m starting to think that the objectgettimebyvalue doesn’t retrieve a date as well
Elaborating on the answer which you've already been given, above...
ObjectGetTimeByValue is intended for things like trend lines, giving you the time value which equates to a price somewhere on the trend line. To get the time value of something like a horizontal line, use:
datetime tm = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME1);
You're then adding 365x60 = 21,900 seconds to the value, or a little over 6 hours. These seems unlikely to be what you intend.
Elaborating on the answer which you've already been given, above...
ObjectGetTimeByValue is intended for things like trend lines, giving you the time value which equates to a price somewhere on the trend line. To get the time value of something like a horizontal line, use:
You're then adding 365x60 = 21,900 seconds to the value, or a little over 6 hours. These seems unlikely to be what you intend.
Should be "vertical". An horizontal line doesn't have a time.
You're obviously right in any meaningful sense. But in a pedantic sense you're wrong. If you create a horizontal line manually (rather than through code), then it does have a time value: the time of the bar which you make the single click on to create the line.
You're obviously right in any meaningful sense. But in a pedantic sense you're wrong. If you create a horizontal line manually (rather than through code), then it does have a time value: the time of the bar which you make the single click on to create the line.
See above.
lool, you are right. Have ever found a usage for this feature ?
No. I'm just trying to find a retrospective justification for stupidly writing "horizontal" instead of "vertical".
No. I'm just trying to find a retrospective justification for stupidly writing "horizontal" instead of "vertical".
![](https://c.mql5.com/3/300/wink__1.gif)
![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
Thats what I have so far. Did some searching but I can't seem to get it to work