_Time Function doesnt correctly calculate Components time
-
Hi Not Work Link https://fxdreema.com/shared/p8XrtPeYd
-
Hi,
There seems to be a problem with the result being returned by _time function under time mode 'Components'.
I have implemented a block as a formula modification for my example because I'm trying to add 30 minutes onto a orders open time unix timestamp but the result wasn't right.
To isolate I set the left value to zero to see what the result coming from _time was.
If you setup like the picture you will see the function does not seem to be supplying the expected value of time beginning from 1st of Jan 1970 but seems like it is calculating from today as its starting value.
If you could please check this on your side.
Thanks
-David

......
fxd_time_calc.png -
This does not return the value of 30 (minutes) *60 (seconds), which is 1800. This returns Unix timestamp, as it is here: http://www.epochconverter.com/
Here is some example where you can see the exact value: https://fxdreema.com/shared/p8XrtPeYdIf you want to add 30 minutes to some time, 30*60 will work. And if you get the time from Condition->Time and you want to add minutes to this time, look at the "Shift in Time" option below.
By the way I found problem with Components part in Condition->Time and I fixed it. I was using some cache before (using static variables) to make it faster, but now I realized that I was missing something and when the day changes the value does not change... so I removed that cache.
-
Thanks - for the clarification - for some reason I thought that returning 30 minutes from unix time from 1970 & adding it to unix time for now would be the same as adding 30 minutes to now.
One feature that would be handy from your suggestion - is to have support for Time Mode - Full DT Stamp (Unix) - as the current Time Stamp suggests its only for HH:MM? - With this feature I could set a variable value that is time shifted forward from trade open unix timestamp without needing to use custom MQL.
-
It's not only HH:MM, the function StrToTime is used, which allows different variants: http://docs.mql4.com/convert/strtotime
But I don't think you need other variants, because they are too specific with their day, month and year, while HH:MM is for the current day. This HH:MM is not the number of seconds, it does not return 1800 when it is 00:30. What it returns is the unix timestamp at 00:30 for the current day.
Adding some time is normally done by adding seconds, for example in the "Adjust" field, something like "+1800" (if the value above is time value of course). There is no "Adjust" for Value-Time, but there is this "Shift in Time", which is basically the same. -
@adakco No project is visible.