From my understanding, aggregation periods seems to work mainly with price rather than volume.
How do I get daily RVOL values on intraday timeframes?
How do I get daily RVOL values on intraday timeframes?
Code:
input threshold = 3.0;
input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;
def agg = AggregationPeriod.DAY;
def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
def relVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
AddLabel(yes, Concat("RVOL: ", AsText(relVol,NumberFormat.TWO_DECIMAL_PLACES)), color.white);