Closing price values not correct on 1 second time scale?

Posted By: Kaga

Closing price values not correct on 1 second time scale? - 12/20/18 15:49

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?
Posted By: Kaga

Re: Closing price values not correct on 1 second time scale? - 12/20/18 16:39

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?
Posted By: jcl

Re: Closing price values not correct on 1 second time scale? - 12/21/18 10:27

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

Re: Closing price values not correct on 1 second time scale? - 12/21/18 18:48

Also, bear in mind that price() is not priceClose().
It will be an average of 5 ticks (1-sec price closes).
Posted By: Kaga

Re: Closing price values not correct on 1 second time scale? - 12/22/18 10:54

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