# cnt_seq_bars_above_ma_00
# https://usethinkscript.com/threads/count-consecutive-bar-closes-above-5-sma.12369/
def na = double.nan;
#def bn = barnumber();
def price = close;
input MA1_len = 5;
#input MA1_type = AverageType.EXPONENTIAL;
input MA1_type = AverageType.simple;
def ma1 = MovingAverage(ma1_type, price, ma1_len);
input show_avg_line = yes;
plot z = if show_avg_line then ma1 else na;
def isup = if close <= ma1 then 0 else isup[1] + 1;
input bar_num = 7;
AssignPriceColor(if isup == bar_num then color.cyan else color.current);
input show_cnt = yes;
plot v = if show_cnt and isup >= bar_num...