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
1 registered members (degenerate_762), 1,098 guests, and 2 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
Closing price values not correct on 1 second time scale? #475549
12/20/18 15:49
12/20/18 15:49
Joined: Dec 2018
Posts: 24
K
Kaga Offline OP
Newbie
Kaga  Offline OP
Newbie
K

Joined: Dec 2018
Posts: 24
I run the following script with 1 second spaced .t1 data:

Code:
function run()
{
	set(TICKS);  
	History=".t1";
	TickTime=1000;
	BarPeriod = 5./60.;	// 5 second bars
	LookBack = 500;
	StartDate =20180105;
	//MaxBars=30000;
	EndDate =StartDate+4; 	// fixed simulation period
	
	assetList("History\AssetsTest.csv"); 
	asset(Assets[0]);

		
// calculate the buy/sell signal
	vars Price = series(price());


// plot signals and thresholds
	plot("plot",Price,NEW,BLUE);
	PlotWidth = 600;
	PlotHeight1 = 300;
	set(PLOTNOW);
}



while the blue plot shows the correct price data from the history file, the black curve labelled as "closing price" shows some weird values:



What am I doing wrong? How can I fix this?

Last edited by Kaga; 12/20/18 15:51.
Re: Closing price values not correct on 1 second time scale? [Re: Kaga] #475550
12/20/18 16:39
12/20/18 16:39
Joined: Dec 2018
Posts: 24
K
Kaga Offline OP
Newbie
Kaga  Offline OP
Newbie
K

Joined: Dec 2018
Posts: 24
Here a more indepth look at the different types of prices that are generated from the tick data:

Code:
function run()
{
	set(TICKS);  // generate and use optimized parameters
	History=".t1";
	TickTime=1000;
	BarPeriod = 5./60.;	// 1 second bars
	LookBack = 50;
	StartDate =20180105;
	EndDate =StartDate+20; 	// fixed simulation period
	
	assetList("HistoryAssetsTest.csv");
	asset(Assets[0]);

// plot signals and thresholds
	 plot("price",price(),0,BLUE);
	 plot("priceOpen",priceOpen(),0,RED);
	 plot("priceHigh-1",priceHigh()-1,0,GREEN);
	 plot("priceLow+1",priceLow()+1,0,CYAN);
	PlotWidth = 600;
	PlotHeight1 = 900;
	PlotHeight2 = 900;
	set(PLOTNOW);
}


with output:



In particular the generated open and close prices seem kind of weird. Would that influence backtesting? How to make all prices appear appropriate?

Last edited by Kaga; 12/20/18 16:57.
Re: Closing price values not correct on 1 second time scale? [Re: Kaga] #475558
12/21/18 10:27
12/21/18 10:27
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
You script just plots the prices from the history. It looks as if the strange values are somewhere in your t1 file.

You can get normal t1 files from the Zorro download page. Check them with your script, then compare them with your t1 file. Possibly some values or dates are wrong. If you can't find the reason, you can contact Support and send them your files.

Re: Closing price values not correct on 1 second time scale? [Re: jcl] #475562
12/21/18 18:48
12/21/18 18:48
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Also, bear in mind that price() is not priceClose().
It will be an average of 5 ticks (1-sec price closes).

Re: Closing price values not correct on 1 second time scale? [Re: Zheka] #475565
12/22/18 10:54
12/22/18 10:54
Joined: Dec 2018
Posts: 24
K
Kaga Offline OP
Newbie
Kaga  Offline OP
Newbie
K

Joined: Dec 2018
Posts: 24
Thank you for your suggestions!
Turns out my assets.csv file had a symbol entry referring to STOOQ data -- so zorro downloaded daily STOOQ data and converted them to t1 and tried to use that instead of my own prepared files. Deleting the STOOQ reference from assets.csv forced Zorro to use my files, and now everything is fine with the prices.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1