You are on page 1of 2

instrument {

name = 'MEDIAS E ZONAS',


icon = 'indicators:MA',
overlay = false
}

--Willy period
length = input(21, "Length LTF", input.integer, 1)
upper = highest(length)
lower = lowest(length)
--Willy period HTF
length2 = input(63, "Length HTF", input.integer, 1)
upper2 = highest(length2)
lower2 = lowest(length2)

band1 = input(-20, 'Top', input.double, -100)


band0 = input(-80, 'Bottom',input.double, -100)

--Calculate willy
out = -100 * (upper - close) / (upper - lower)
src = out
len = input(13, "Length LTF EMA", input.integer, 1)
--Compute the EMA of Willy
out2 = ema(out, len)
--Add the top and bottom ranges for Willy to be considered stupid

--Calculate willy HTF


out22 = -100 * (upper2 - close) / (upper2 - lower2)
src22 = out22
len22 = input(39, "Length HTF EMA", input.integer, 1)
--Compute the EMA of Willy HTF
out222 = ema(out22, len22)

--Color the background where Willy is stupid


fill(0, band1, 'stupid-overbought', iff(out2 > -20, "lime", "gray"))
fill(band0, -100, 'stupid-oversold', iff(out2 < -80 , "red", "gray"))

--Color the background where Willy HTF is stupid


fill(out222, band1, 'stupid-overbought-HTF', iff(out222 > -20, "green", 0))
fill(out222, band0, 'stupid-oversold-HTF', iff(out222 < -80, "fuchsia", 0))
--Add the background to the middle area
fill_area(band0, band1, 'background', "#2F4F4F")

--Draw the mid point -50


hline(band1, "OVB","#888888", 1, 0, style.dash_line, true)
hline(-50, "Mid Point","#888888", 1, 0, style.dash_line, true)
hline(band0, "OVS","#888888", 1, 0, style.dash_line, true)

--Draw the Willy and EMA


plot(out, "Willy", "aqua", 2)
plot(out2, "EMA", "red", 2)

plot(out22, "Willy HTF", "teal", 2)


plot(out222, "EMA HTF", "maroon" , 2)

You might also like