```
def c1 = close(period = aggregationperiod.min);
def c2 = close(period = aggregationperiod.two_min);
def c3 = close(period = aggregationperiod.five_min);
def c4 = close(period = aggregationperiod.ten_min);
def c5 = close(period = aggregationperiod.thirty_min);
def avg1 = average(c1,20);
def avg2 = average(c2,20);
def avg3 = average(c3,20);
def avg4 = average(c4,20);
def avg5 = average(c5,20);
addlabel(1, if close > avg1 then "1 min above 20 SMA" else "1 min below 20 SMA",
if close > avg1 then color.green else color.red);
addlabel(1, if close > avg2 then "2 min above 20 SMA" else "5 min below 20 SMA",
if close > avg2 then color.green else color.red);
addlabel(1, if close > avg3 then "5 min above 20 SMA" else "15 min below 20 SMA",
if close > avg3 then color.green else color.red);
addlabel(1, if close > avg3 then "10 min above 20 SMA" else "15 min below 20 SMA",
if close > avg3 then color.green else color.red);
addlabel(1, if close > avg3 then "30 min above 20 SMA" else "15 min below 20 SMA",
if close > avg3 then color.green else color.red);
```