Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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