Brand new to this. The following script is intended to show a label to display a moving average of the wick percent of candles. It runs but it is clearly using the current candle only when it should use only the previous x number of candles (avglength). I clearly don't understand offset.
input avgType = averageType.Simple;
input avgLength = 5;
input avgOffset = 1;
def rg = absvalue(high - low);
def cb = absvalue(open - close);
Def wProp = ((rg-cb)/rg)*100;
def avg= movingaverage(avgType, wprop,avgLength)[avgOffset];
Addlabel( yes, "Wick%: " + wProp, Color.White );
input avgType = averageType.Simple;
input avgLength = 5;
input avgOffset = 1;
def rg = absvalue(high - low);
def cb = absvalue(open - close);
Def wProp = ((rg-cb)/rg)*100;
def avg= movingaverage(avgType, wprop,avgLength)[avgOffset];
Addlabel( yes, "Wick%: " + wProp, Color.White );