Out Of The Box
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © chocolatebear

//@version=4
study("Out Of The Box", shorttitle="OOTB", overlay=true)

t = input(defval=close, title="top", type=input.source)
b = input(defval=close, title="bottom", type=input.source)
l = input(defval=60, title="length", type=input.integer, minval=1, maxval=1000)
d = input(defval=5, title="displacement", type=input.integer, minval=0, maxval=1000)

c = highest(t, l)
g = lowest(b, l)
m = ((c + g) * 0.5)
uf = (g + ((c - g)*0.618))
tf = (g + ((c - g)*0.786))
lf = (c - ((c - g)*0.618))
gf = (c - ((c - g)*0.786))

plot(c, title="ceiling", color=(color.green), linewidth=1, style=plot.style_line, offset=d)
plot(tf, title="top floor", color=color.green, linewidth=1, style=plot.style_line, offset=d)
plot(uf, title="upper floor", color=color.green, linewidth=1, style=plot.style_line, offset=d)
plot(m, title="mid", color=color.orange, linewidth=1, style=plot.style_line, offset=d)
plot(lf, title="lower floor", color=color.red, linewidth=1, style=plot.style_line, offset=d)
plot(gf, title="ground floor", color=color.red, linewidth=1, style=plot.style_line, offset=d)
plot(g, title="ground", color=color.red, linewidth=1, style=plot.style_line, offset=d)