Consider the following code, where marketVol does contain the volume

Code:
// Custom Bars
static int vol = 0;

int bar(vars Open, vars High, vars Low, vars Close)
{
	//printf("nVol %i", vol);
	vol += marketVol();
	if (vol >= 500) {
		vol = 0;
		return 1;
	}
	return 4;
}

function run() {
	set(TICKS);
	StartDate = 20150101;
	EndDate = 20150115;
	set(PLOTNOW);
	BarPeriod = 10;
	vars Close = series(priceClose());
	plot("Vol",marketVol(),NEW,RED);
}



This leads to the attached (zoomed in) chart, where all bars have a volume less than 500. I would expect them to be > 500 ?

Attached Files