Can someone from this comunity please help to reverse this scanner from looking from bars above to bars below?
Ruby:
# zclsaboveema1
# priceaboveEMA_xbars_01 - upper
def bn = barnumber();
input avg1_len = 80;
input avg1_type = AverageType.EXPONENTIAL;
def ma1 = MovingAverage(avg1_type, close, avg1_len);
input barsback = 20;
def abovexbars = ( Sum( (close > ma1), barsback ) == barsback );
def xbarscnt = if bn == 1 then 0 else if !abovexbars then 0 else if (abovexbars and !abovexbars[1] ) then 1 else if abovexbars then xbarscnt[1] + 1 else xbarscnt[1];
plot z = xbarscnt;
z.setdefaultcolor(color.dark_gray);
assignbackgroundcolor( if abovexbars then color.yellow else color.current);
#
Last edited by a moderator: