Lençol (Bedsheet)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jacobfabris

//@version=4
study("Lençol",overlay = true)
T = input(defval=305,minval=4)
spot  = close 
G1 = 0.0
G2= 0.0
G3= 0.0
G4= 0.0
G5= 0.0
G6= 0.0
G7= 0.0
G8= 0.0
G9= 0.0
G10= 0.0
G11= 0.0
G12= 0.0
G13= 0.0
G14= 0.0
G15 = 0.0
G16 = 0.0

G1  := spot*17.9436/T + nz(G1[1])*(1-17.9436/T)
G2  := spot*15.2841/T + nz(G2[1])*(1-15.2841/T)
G3  := spot*13.0000/T + nz(G3[1])*(1-13.0000/T)
G4  := spot*11.0893/T + nz(G4[1])*(1-11.0893/T)
G5  := spot*09.4457/T + nz(G5[1])*(1-09.4457/T)
G6  := spot*08.0458/T + nz(G6[1])*(1-08.0458/T)
G7  := spot*06.8533/T + nz(G7[1])*(1-06.8533/T)
G8  := spot*05.8376/T + nz(G8[1])*(1-05.8376/T)
G9  := spot*04.9724/T + nz(G9[1])*(1-04.9724/T)
G10 := spot*04.2360/T + nz(G10[1])*(1-04.2360/T)
G11 := spot*03.6077/T + nz(G11[1])*(1-03.6077/T)
G12 := spot*03.0730/T + nz(G12[1])*(1-03.0730/T)
G13 := spot*02.6175/T + nz(G13[1])*(1-02.6175/T)
G14 := spot*02.2296/T + nz(G14[1])*(1-02.2296/T)
G15 := spot*01.9000/T + nz(G15[1])*(1-01.9000/T)
G16 := spot*01.6180/T + nz(G16[1])*(1-01.6180/T)

cor1  = G1 > G1[1] ? color.lime : color.yellow
cor2  = G2 > G2[1] ? color.teal : color.orange
cor3  = G3 > G3[1] ? color.teal : color.orange
cor4  = G4 > G4[1] ? color.teal : color.orange
cor5  = G5 > G5[1] ? color.teal : color.orange
cor6  = G6 > G6[1] ? color.teal : color.orange
cor7  = G7 > G7[1] ? color.teal : color.orange
cor8  = G8 > G8[1] ? color.teal : color.orange
cor9  = G9 > G9[1] ? color.teal : color.orange
cor10 = G10 > G10[1] ? color.white : color.silver
cor11 = G10 > G11[1] ? color.teal : color.orange
cor12 = G12 > G12[1] ? color.teal : color.orange
cor13 = G13 > G13[1] ? color.teal : color.orange
cor14 = G14 > G14[1] ? color.teal : color.orange
cor15 = G15 > G15[1] ? color.teal : color.orange
cor16 = G16 > G16[1] ? color.yellow : color.red

plot(G1,color=cor1,linewidth=2)
plot(G2,color=cor2)
plot(G3,color=cor3)
plot(G4,color=cor4)
plot(G5,color=cor5)
plot(G6,color=cor6)
plot(G7,color=cor7)
plot(G8,color=cor8)
plot(G9,color=cor9)
plot(G10,color=cor10,linewidth=2)
plot(G11,color=cor11)
plot(G12,color=cor12)
plot(G13,color=cor13)
plot(G14,color=cor14)
plot(G15,color=cor15)
plot(G16,color=cor16,linewidth=2)
