Return current bar in Unix time

Posted By: gamadeus

Return current bar in Unix time - 05/24/19 05:32

Hello,

I am struggling to get Zorro to return the current bar in Unix time.
Apparently that can be done via utm() but I have trouble finding the correct var Date to feed.

Can someone help me with that?
Posted By: jcl

Re: Return current bar in Unix time - 05/24/19 11:04

utm(wdate(0))
Posted By: gamadeus

Re: Return current bar in Unix time - 05/30/19 11:15

Thanks Jcl!

One problem though I have with this is that when I run this in Trademode under FRISTRUN it will not give me the current bar and timestamp but the first Lookback bar.

Is there any way to just get the current timestamp in that format without any bar offset required?

And a related question: is there a flag similar to FIRSTRUN that is triggered on the first bar after the Lookback period?
Posted By: Zheka

Re: Return current bar in Unix time - 05/30/19 14:04


if (!is(LOOKBACK))
{
}
Posted By: gamadeus

Re: Return current bar in Unix time - 05/30/19 14:23

yes thanks of course I am aware of that.
but I want to know if there is a flag similar to INITRUN for Lookback, because !is(LOOKBACK) is true for every run after the lookback period
Posted By: AndrewAMD

Re: Return current bar in Unix time - 05/30/19 16:09

Code:
if(Bar==StartBar)
{
}


https://zorro-project.com/manual/en/numbars.htm
Posted By: gamadeus

Re: Return current bar in Unix time - 05/30/19 16:24

thanks a lot Andrew, should have realized that myself!
Posted By: Trader_Joey

Re: Return current bar in Unix time - 03/25/20 14:28

i have managed to get the timestamp of the last tick with utm(wdate(0)). But as far as i can see this only returns the Unix time in seconds, not in milliseconds. Is there any way to receive the Unix time stamp in milliseconds?
Posted By: jcl

Re: Return current bar in Unix time - 03/25/20 16:51

You can directly convert it to ms, this is the formula:

Unix_ms = (wdate(0)-25569.)*(24*60*60*1000)
Posted By: Trader_Joey

Re: Return current bar in Unix time - 03/25/20 17:08

Thanks for the help!
© 2024 lite-C Forums