Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, EternallyCurious, Petra, 1 invisible), 788 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Inconsistent prices when using different BarPeriods #444987
08/25/14 04:39
08/25/14 04:39
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
Hi, I modified an example from the manual to export prices of the diferent assets to .csv files. Here is the code:
Click to reveal..

Code:
function run()
{
	BarPeriod = 60;//1440;
	StartDate = 2008;
	EndDate = 2012;
	LookBack = 0;
	//Verbose = 30;
	
	while(asset(loop("EUR/USD","USD/JPY","GBP/USD","USD/CHF"))){

		char line[100];
		sprintf(line,
		"%02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5f, %5f\n",
		day(),month(),year()%100,hour(),minute(),
		priceOpen(),priceHigh(),priceLow(),priceClose(),price()); 
		
		char file_path[100];
		char a[7];
		strcpy(a,Asset);    
		sprintf(file_path,
		"%s %s-%s %d-%d %d minute bars%s",
		"Data\\export",strtok(a,"/"),strtok(0,"/"),StartDate,EndDate,BarPeriod,".csv");    
		
		if(is(INITRUN)){    	 
			//msg(Asset);
			file_delete(file_path);
		file_append(file_path,"Time,Open,High,Low,Close,Mean Price\n");}
		else
		file_append(file_path,line);
		
		
	}
}




But the problem is that there are differences between the hourly and daily bars close prices, for instance look at these fragments (Time,Open,High,Low,Close), only the 16 jun 2010 is the same. Should I worry? Why the differences? Thanks beforehand!

EUR/USD Daily bars:

11/06/2010 00:00 1.19867 1.2141 1.19555 1.21292
14/06/2010 00:00 1.21292 1.22073 1.20436 1.22033
15/06/2010 00:00 1.22033 1.22973 1.21628 1.22132
16/06/2010 00:00 1.22132 1.23484 1.21671 1.23148
17/06/2010 00:00 1.23148 1.23524 1.22535 1.23015

EUR/USD Hourly bars:

11/06/2010 00:00 1.2102 1.21332 1.20995 1.213
11/06/2010 01:00 1.213 1.21475 1.21078 1.21161
11/06/2010 02:00 1.21161 1.212 1.20998 1.21039
11/06/2010 03:00 1.21039 1.21074 1.2092 1.21002
11/06/2010 04:00 1.21002 1.21128 1.20954 1.21003
11/06/2010 05:00 1.21003 1.21172 1.20985 1.21059
11/06/2010 06:00 1.21059 1.21159 1.20973 1.21131
11/06/2010 07:00 1.21131 1.21176 1.20941 1.21072
11/06/2010 08:00 1.21072 1.21394 1.21023 1.21122
11/06/2010 09:00 1.21122 1.21185 1.20903 1.21084
11/06/2010 10:00 1.21084 1.2131 1.21084 1.21279
11/06/2010 11:00 1.21279 1.21324 1.21085 1.21262
11/06/2010 12:00 1.21262 1.21515 1.21244 1.21457
11/06/2010 13:00 1.21457 1.21511 1.2082 1.2084
11/06/2010 14:00 1.2084 1.21265 1.20783 1.21157
11/06/2010 15:00 1.21157 1.21304 1.20912 1.20915
11/06/2010 16:00 1.20915 1.20933 1.20436 1.20756
11/06/2010 17:00 1.20756 1.20777 1.20545 1.20601
11/06/2010 18:00 1.20601 1.20766 1.20555 1.20617
11/06/2010 19:00 1.20617 1.20842 1.20598 1.20756
13/06/2010 23:00 1.20756 1.21505 1.20711 1.21436
14/06/2010 00:00 1.21436 1.22059 1.21436 1.2204
14/06/2010 01:00 1.2204 1.22073 1.21723 1.21744
14/06/2010 02:00 1.21744 1.21903 1.21681 1.2172
14/06/2010 03:00 1.2172 1.21808 1.21673 1.21736
14/06/2010 04:00 1.21736 1.21871 1.21733 1.21813
14/06/2010 05:00 1.21813 1.21813 1.21675 1.2173
14/06/2010 06:00 1.2173 1.21875 1.21688 1.21868
14/06/2010 07:00 1.21868 1.22036 1.21731 1.21745
14/06/2010 08:00 1.21745 1.2188 1.21628 1.21737
14/06/2010 09:00 1.21737 1.22328 1.21646 1.22233
14/06/2010 10:00 1.22233 1.22576 1.22216 1.22498
14/06/2010 11:00 1.22498 1.22515 1.22331 1.22331
14/06/2010 12:00 1.22331 1.22499 1.22158 1.22423
14/06/2010 13:00 1.22423 1.22722 1.22413 1.22647
14/06/2010 14:00 1.22647 1.22647 1.22287 1.22378
14/06/2010 15:00 1.22378 1.2278 1.22369 1.22777
14/06/2010 16:00 1.22777 1.22973 1.22725 1.22751
14/06/2010 17:00 1.22751 1.22922 1.22502 1.22503
14/06/2010 18:00 1.22503 1.2263 1.22272 1.22272
14/06/2010 19:00 1.22272 1.22412 1.22154 1.22401
14/06/2010 20:00 1.22401 1.22556 1.22202 1.22237
14/06/2010 21:00 1.22237 1.22299 1.22174 1.2219
14/06/2010 22:00 1.2219 1.2222 1.22069 1.22124
14/06/2010 23:00 1.22124 1.22259 1.22124 1.2214
15/06/2010 00:00 1.2214 1.22149 1.22044 1.22101
15/06/2010 01:00 1.22101 1.22314 1.22101 1.22251
15/06/2010 02:00 1.22251 1.22278 1.21949 1.22053
15/06/2010 03:00 1.22053 1.22185 1.22016 1.22091
15/06/2010 04:00 1.22091 1.22246 1.22072 1.22186
15/06/2010 05:00 1.22186 1.22236 1.22006 1.22077
15/06/2010 06:00 1.22077 1.22191 1.22 1.22126
15/06/2010 07:00 1.22126 1.22145 1.21674 1.21682
15/06/2010 08:00 1.21682 1.21964 1.21671 1.21929
15/06/2010 09:00 1.21929 1.22141 1.21844 1.2209
15/06/2010 10:00 1.2209 1.22481 1.2174 1.22451
15/06/2010 11:00 1.22451 1.22651 1.22441 1.22504
15/06/2010 12:00 1.22504 1.22751 1.22504 1.22601
15/06/2010 13:00 1.22601 1.22769 1.22428 1.22674
15/06/2010 14:00 1.22674 1.23041 1.22661 1.22881
15/06/2010 15:00 1.22881 1.23116 1.22605 1.23061
15/06/2010 16:00 1.23061 1.23316 1.23037 1.23255
15/06/2010 17:00 1.23255 1.23423 1.23211 1.23309
15/06/2010 18:00 1.23309 1.23484 1.23256 1.23371
15/06/2010 19:00 1.23371 1.23466 1.23301 1.23316
15/06/2010 20:00 1.23316 1.2347 1.23261 1.23449
15/06/2010 21:00 1.23449 1.23451 1.2317 1.23297
15/06/2010 22:00 1.23297 1.2332 1.23182 1.2322
15/06/2010 23:00 1.2322 1.23241 1.23141 1.23156
16/06/2010 00:00 1.23156 1.23226 1.23101 1.23148
16/06/2010 01:00 1.23148 1.23198 1.23078 1.23111
16/06/2010 02:00 1.23111 1.23221 1.23111 1.23141
16/06/2010 03:00 1.23141 1.23196 1.23071 1.23151
16/06/2010 04:00 1.23151 1.23255 1.23128 1.23171
16/06/2010 05:00 1.23171 1.23336 1.23097 1.23278
16/06/2010 06:00 1.23278 1.23393 1.23216 1.23278
16/06/2010 07:00 1.23278 1.23524 1.23201 1.23405
16/06/2010 08:00 1.23405 1.23411 1.22735 1.22855
16/06/2010 09:00 1.22855 1.23022 1.22725 1.22994
16/06/2010 10:00 1.22994 1.23032 1.22831 1.23005
16/06/2010 11:00 1.23005 1.23058 1.22815 1.22866
16/06/2010 12:00 1.22866 1.2298 1.22663 1.22791
16/06/2010 13:00 1.22791 1.22855 1.22535 1.22836
16/06/2010 14:00 1.22836 1.2317 1.22804 1.23168
16/06/2010 15:00 1.23168 1.23253 1.22933 1.23153
16/06/2010 16:00 1.23153 1.23361 1.23053 1.23217
16/06/2010 17:00 1.23217 1.23367 1.2295 1.23131
16/06/2010 18:00 1.23131 1.2321 1.22983 1.23166
16/06/2010 19:00 1.23166 1.23283 1.22999 1.23113
16/06/2010 20:00 1.23113 1.23113 1.22952 1.23016
16/06/2010 21:00 1.23016 1.23135 1.22987 1.23087
16/06/2010 22:00 1.23087 1.23138 1.22958 1.22983
16/06/2010 23:00 1.22983 1.2311 1.22978 1.2311
17/06/2010 00:00 1.2311 1.2312 1.22964 1.22982

Re: Inconsistent prices when using different BarPeriods [Re: Mithrandir77] #445138
08/28/14 12:31
08/28/14 12:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I also don't see a reason of the differences at a first glance. I've forwarded ths question to the developers - we should get a response in the next days.

Re: Inconsistent prices when using different BarPeriods [Re: jcl] #445148
08/28/14 16:19
08/28/14 16:19
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, I already got a response:

The printed time is the end of the bar, not its begin. So the Open is naturally different. The Close is the same, but only almost - it can differ by 1 tick. The 1-tick difference has a technical reason due to the sampling. It does not affect the test results, but I admit that it might look ugly - therefore I've suggested to modify the sampling so that the closing tick is always the same.

Re: Inconsistent prices when using different BarPeriods [Re: jcl] #445164
08/29/14 06:29
08/29/14 06:29
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
Originally Posted By: jcl
Ok, I already got a response:

The printed time is the end of the bar, not its begin. So the Open is naturally different. The Close is the same, but only almost - it can differ by 1 tick. The 1-tick difference has a technical reason due to the sampling. It does not affect the test results, but I admit that it might look ugly - therefore I've suggested to modify the sampling so that the closing tick is always the same.


Thanks for the answer and for prompt checking it, you and the developers are doing a great job!


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