Market Breadth EMAs
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © OverexposedPhotoOfADress

//@version=5
indicator("Market Breadth EMAs")
s20 = request.security("S5TW", "D", close) // 20 Day
s50 = request.security("S5FI", "D", close) // 50 Day
s100 = request.security("S5OH", "D", close) // 100 Day
s200 = request.security("S5TH", "D", close) // 200 Day
plot(s20, color=color.green, linewidth=2)
plot(s50, color=color.yellow, linewidth=2)
plot(s100, color=color.orange, linewidth=2)
plot(s200, color=color.red, linewidth=2)
h1 = hline(0, color=color.new(color.white,100))
h2 = hline(2, color=color.new(color.white,100))
h3 = hline(14, color=color.new(color.white,100))
h4 = hline(21, color=color.new(color.white,100))
h5 = hline(33, color=color.new(color.white,100))
h6 = hline(70, color=color.new(color.white,100))
h7 = hline(78, color=color.new(color.white,100))
h8 = hline(85, color=color.new(color.white,100))
h9 = hline(95, color=color.new(color.white,100))
h10 = hline(100, color=color.new(color.white,100))
h11 = hline(49.5, color=color.new(color.white,100))
h12 = hline(50.5, color=color.new(color.white,100))
fill(h1, h5, color=color.new(color.lime,95))
fill(h1, h4, color=color.new(color.lime,95))
fill(h1, h3, color=color.new(color.lime,95))
fill(h1, h2, color=color.new(color.lime,95))
fill(h6, h10, color=color.new(color.red,95))
fill(h7, h10, color=color.new(color.red,95))
fill(h8, h10, color=color.new(color.red,95))
fill(h9, h10, color=color.new(color.red,95))
fill(h11, h12, color=color.new(color.white,75))