Hi there buddy, here I thought of another idea that can make use of the cumulativedelta indicator formula. What you can do is remove from the code the plotting of the subwindow with the candles, we are only interested to see numerical values in this one. The indicator would display in a corner of the chart (better to make a label that we ca drag and drop) the delta values for each timeframe (I have attached an image of how it is supposed to look like).
In indicator settings there will be an input "lookback period" where we set the number of bars to sum the delta. For example, if I set "7" there, then the numerical values would correspond to the sum of the delta of the last 7 bars (including the current one). If this input is left blank or 0, then the values displayed in the table correspond only to the current bar.
You can also remove from the code the "print history" feature, it won´t be used, might save CPU power.
Best regards
EDIT> editing the post to adjust some nomenclature, actually I should not have use the word "average" because it is not what it is supposed to do, it is summing of delta that we want.