Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Puzzle with time functions #475112
11/23/18 14:35
11/23/18 14:35
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Dear All,

I am looking to understand why this script:
Quote:
function run()
{
BarPeriod=1;
LookBack=1;
Verbose=7;

if(is(INITRUN))
{
assetList("AssetsIB");
asset("EUR/USD");
}

if(!is(LOOKBACK))
{
var curDate=wdate(0);
printf("n curDate=%.5f,YMD=%i, TOD=%i, utcDOW=%i, estDOW=%i", curDate, ymd(curDate), tod(curDate), dow(curDate), ldow(EST,curDate));
}
}
Generates in TRADE MODE:
Quote:
57 Bars 2018-11-22..2018-11-22 generated
V 1.964 on Thu 18-11-22 11:10:58
EUR/USD 1.14041 0.00003 0.000 0.000 0.00010 1.00000 344.8333 1000.0 3000000.0

Lookback period (1 bars)

[56: Thu 18-11-22 16:10] 1.14045/1.140451.14028/1.14038 -0.000030000

End of lookback period

[57: Thu 18-11-22 16:11] 1.14041/1.140411.14041/1.14041 -0.000030000
curDate=43426.67431,YMD=20181122, TOD=0, utcDOW=4, estDOW=3

Why - according to Support- does a var variable curDATE gets passed as int to tod() and ldow()?

Any hints are much appreciated.

Re: Puzzle with time functions [Re: Zheka] #475113
11/23/18 14:56
11/23/18 14:56
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Because the function parameters are ints, not vars.

http://manual.zorro-project.com/month.htm

Re: Puzzle with time functions [Re: jcl] #475117
11/23/18 15:15
11/23/18 15:15
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
As per manual:
Quote:
Offset: Optional offset of the bar for which the date or time is returned, to the current bar; or 0 for the current bar;
or NOW for the current PC time;
or when > 30000, a particular date in DATE format..
This used to work, and even now dow() returns the correct number...but not ldow()

Has this changed?

Re: Puzzle with time functions [Re: Zheka] #475118
11/23/18 16:12
11/23/18 16:12
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Or DATE - which is a var - gets typecasted to int?

This would explain why tod(DATE) returns 0, but not why ldow() returns the previous day..

But then this would mean that all time-returning functions do not really work when passed a DATE, and the manual creates wrong expectations...


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1