Zorro 2.40.8 current date in Live mode

Posted By: simonkrebs

Zorro 2.40.8 current date in Live mode - 09/22/21 15:36

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());

}
Posted By: Petra

Re: Zorro 2.40.8 current date in Live mode - 09/26/21 11:32

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.
Posted By: simonkrebs

Re: Zorro 2.40.8 current date in Live mode - 10/01/21 07:18

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
© 2024 lite-C Forums