I'll borrow this thread as well for some other questions regarding priceXXX()

When backtesting on 1-minute data, I observe some strange behavior where priceOpen() almost always equals priceHigh(). Same for priceClose() == priceLow().

However, when you look at the structs stored in the .bar history file you can clearly see much more different values for open, high, low and close.
Its as if priceOpen() and priceHigh() are identical for BarPeriod = 1 when backtesting.

Try this script:
Code:
int numBars = 0;
int numOpenHighNonMatching = 0;
int numCloseLowNonMatching = 0;

function run() {
	StartDate = 20070101;
	EndDate = 20070630;
	LookBack = 0;
	BarPeriod = 1;
	asset("EUR/USD");
	
	if (is(INITRUN)) {
		numBars = 0;
		numOpenHighNonMatching = 0;
		numCloseLowNonMatching = 0;
	}

	numBars++;
	
	if (priceOpen() != priceHigh()) {
		numOpenHighNonMatching++;
	}
	
	if (priceClose() != priceLow()) {
		numCloseLowNonMatching++;
	}
	
	
	if (is(EXITRUN)) {
		printf("\nNum bars received: %d\n", numBars - 1);
		printf("\nTotal non-matching: %d", numOpenHighNonMatching + numCloseLowNonMatching);
	}
}



For me that script outputs,
Code:
BackTest: bar_export EUR/USD 2007
Num bars received: 151067
Total non-matching: 43



Looking at the raw .bar files, I would expect non-matching to be much higher, even for BarPeriod = 1.
Naturally, turning up BarPeriod to say 60 or higher shows more normal and different values.

Do Zorro handle prices at BarPeriod = 1 differently compared to higher periods?

I also noticed that bars at the beginning of the year (those last in .bar file) are sometimes skipped for some reason?

Maybe I've just misunderstood something, but I've been scratching my head over this one for over 2 hours laugh
Thanks!

Last edited by pipclown; 01/03/14 00:38.