Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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