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?
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;
}