# ..AverageTypes..
# EXPONENTIAL
# HULL
# SIMPLE
# WEIGHTED
# WILDERS
# SMA 7
# SMA 10
# SMA 20
# SMA 35
# Hull 8
input range = 0.15;
def price = close;
input MA1_len = 7;
input MA1_type = AverageType.simple;
def ma1 = MovingAverage(ma1_type, price, ma1_len);
input MA2_len = 10;
input MA2_type = AverageType.simple;
def ma2 = MovingAverage(ma2_type, price, ma2_len);
input MA3_len = 20;
input MA3_type = AverageType.simple;
def ma3 = MovingAverage(ma3_type, price, ma3_len);
input MA4_len = 35;
input MA4_type = AverageType.simple;
def ma4 = MovingAverage(ma4_type, price, ma4_len);
input MA5_len = 8;
input MA5_type = AverageType.hull;
def ma5 = MovingAverage(ma5_type, price, ma5_len);
#------------------------------------------
def minx = min(ma1,min(ma2,min(ma3,min(ma4,ma5))));
def maxx = max(ma1,max(ma2,max(ma3,max(ma4,ma5))));
def sqz = if ((maxx - minx) <= range) then 1 else 0;
# ---------------------------------
plot s = sqz;
# delete code after this line. use above code for a scan
s.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
s.setdefaultcolor(color.cyan);
s.hidebubble();
# -----------------------------------------------------
input show_lines = yes;
#x.SetHiding(!show_lines);
plot z1 = ma1;
z1.setdefaultcolor(color.cyan);
z1.hidebubble();
z1.SetHiding(!show_lines);
plot z2 = ma2;
z2.setdefaultcolor(color.cyan);
z2.hidebubble();
z2.SetHiding(!show_lines);
plot z3 = ma3;
z3.setdefaultcolor(color.cyan);
z3.hidebubble();
z3.SetHiding(!show_lines);
plot z4 = ma4;
z4.setdefaultcolor(color.cyan);
z4.hidebubble();
z4.SetHiding(!show_lines);
plot z5 = ma5;
z5.setdefaultcolor(color.cyan);
z5.hidebubble();
z5.SetHiding(!show_lines);
#