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 (howardR), 650 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Zorro 2.40.8 current date in Live mode #484224
09/22/21 15:36
09/22/21 15:36
Joined: Apr 2021
Posts: 19
S
simonkrebs Offline OP
Newbie
simonkrebs  Offline OP
Newbie
S

Joined: Apr 2021
Posts: 19
I tested Zorro 2.40.8 vs. Zorro 2.35.9, here are some observations I made:
- LookBack 0 in Live mode causes current date to jump to tomorrow as current date
- StartDate = NOW in Live mode causes current date to jump to tomorrow as current date (example: date 2021-09-22, output day() function -> 23)

I attached my testing script.

Code
function run() {
	
	// Initialize strategy parameters
	set(PLOTNOW+PRELOAD+LOGFILE);
	LookBack = 1; // 0 doesn't work -> Forces current day to jump to tomorrows date in Live mode
	BarMode = BR_WEEKEND+BR_MARKET+BR_FLAT+BR_SLEEP+BR_LOGOFF; 
	BarPeriod = 1440;
	BarOffset = 15*60 + 40; // set the bar end to 15:40, 20 minutes before NY market close
	BarZone = ET;
	StartMarket = 0930;
	EndMarket = 1610;
	NumCores = -2;	
	Hedge = 2; // Allow long/short positions at the same time -> need to check if Alpaca allowes this!
	
	Capital = slider(1,1000,0,20000,"Capital","");
	Verbose = slider(2,7,0,7,"Verbose","");
	if(!Live) StartDate = 20180101; 
	//StartDate = ifelse(Live,NOW,20180101); // Doesn't work -> Forces current day to jump to tomorrows date in Live mode
	EndDate = NOW;
	
	assetList("AssetsALP-VIX");
	asset("MTG");
	printf("\n%d-%d-%d: %s price=%.2f",year(),month(),day(),Asset,priceClose());

}

Last edited by simonkrebs; 09/22/21 15:37.
Re: Zorro 2.40.8 current date in Live mode [Re: simonkrebs] #484255
09/26/21 11:32
09/26/21 11:32
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
I believe the time functions return the time at the end of the current bar. Not the current time. For the current time you must use day(NOW).

But will forward this to the developers. Maybe they change it in the next beta so that with StartDate=NOW the current time is also returned.

Re: Zorro 2.40.8 current date in Live mode [Re: simonkrebs] #484293
10/01/21 07:18
10/01/21 07:18
Joined: Apr 2021
Posts: 19
S
simonkrebs Offline OP
Newbie
simonkrebs  Offline OP
Newbie
S

Joined: Apr 2021
Posts: 19
Thanks, Petra.

Regarding the LookBack issue: I tested LookBack = 0 in the current Zorro Beta 2.42.2, there it works correctly like in the past and doesn’t skip dates. So what I described is a bug in the current productive version, right?

Regarding the NOW issue: Unfortunately your solution date(NOW) didn‘t work for me


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