I know we can generate custom bars with the bar function.
I tried creating volume bars using variants of the code below, but it doesn´t look like expected. Atleast the plot does not reflect bars that contain atleast a volume of 500.
Can we create volume/dollar bars?

Code:
static int vol = 0;

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


Last edited by Dalla; 01/06/19 20:29.