RicardoSantos

[RS]Time Based Thermal Support and Resistance V0

EXPERIMENTAL:
theres a bug where certain dates dont work for the loop, returning a out of index error, please review..
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
//@version=2
study(title='[RS]Time Based Thermal Support and Resistance V0', shorttitle='T',overlay=true)
d_year = input(2016)
d_month = input(04)
d_day = input(1)
d_hour = input(0)
d_minute = input(0)
isvalid_time = time >= timestamp(d_year, d_month, d_day, d_hour, d_minute) 
src = input(close)
length = input(100)

f_frequency_of_range(_src, _lower, _upper, _length)=>
    _adjusted_length = _length < 1 ? 1 : _length
    _frequency = 0
    for _i = 0 to _adjusted_length-1
        if (_src[_i] >= _lower and _src[_i] <= _upper)
            _frequency := _frequency + 1
    _return = nz(_frequency/_adjusted_length, 0)

h = isvalid_time ? (high >= nz(h[1], high[1]) ? high : h[1]) : na
l = isvalid_time ? (low <= nz(l[1], low[1]) ? low : l[1]) : na
r = h-l
fraction =  r * 0.1
start_bar = change(isvalid_time) > 0 ? n : start_bar[1]
window = n - start_bar

f01 = f_frequency_of_range(src, l, l+fraction*1, window)
f02 = f_frequency_of_range(src, l+fraction*1, l+fraction*2, window)
f03 = f_frequency_of_range(src, l+fraction*2, l+fraction*3, window)
f04 = f_frequency_of_range(src, l+fraction*3, l+fraction*4, window)
f05 = f_frequency_of_range(src, l+fraction*4, l+fraction*5, window)
f06 = f_frequency_of_range(src, l+fraction*5, l+fraction*6, window)
f07 = f_frequency_of_range(src, l+fraction*6, l+fraction*7, window)
f08 = f_frequency_of_range(src, l+fraction*7, l+fraction*8, window)
f09 = f_frequency_of_range(src, l+fraction*8, l+fraction*9, window)
f10 = f_frequency_of_range(src, l+fraction*9, h, window)

// r00 = plot(l, color=black)
// r01 = plot(l+((fraction*1) * f01), color=blue)
// r02 = plot(l+((fraction*1)), color=blue)
// r03 = plot(l+((fraction*1) + fraction * f02), color=blue)
// r04 = plot(l+((fraction*2)), color=blue)
// r05 = plot(l+((fraction*2) + fraction * f03), color=blue)
// r06 = plot(l+((fraction*3)), color=blue)
// r07 = plot(l+((fraction*3) + fraction * f04), color=blue)
// r08 = plot(l+((fraction*4)), color=blue)
// r09 = plot(l+((fraction*4) + fraction * f05), color=blue)
// r10 = plot(l+((fraction*5)), color=blue)
// r11 = plot(l+((fraction*5) + fraction * f06), color=blue)
// r12 = plot(l+((fraction*6)), color=blue)
// r13 = plot(l+((fraction*6) + fraction * f07), color=blue)
// r14 = plot(l+((fraction*7)), color=blue)
// r15 = plot(l+((fraction*7) + fraction * f08), color=blue)
// r16 = plot(l+((fraction*8)), color=blue)
// r17 = plot(l+((fraction*8) + fraction * f09), color=blue)
// r18 = plot(l+((fraction*9)), color=blue)
// r19 = plot(l+((fraction*9) + fraction * f10), color=blue)
// r20 = plot(h, color=black)

t01_color = f01 >= 0.00 and f01 < 0.10 ? #336699 :
         f01 >= 0.10 and f01 < 0.20 ? #0099cc :
         f01 >= 0.20 and f01 < 0.30 ? #00ccff :
         f01 >= 0.30 and f01 < 0.40 ? #33ccff :
         f01 >= 0.40 and f01 < 0.50 ? #66ccff :
         f01 >= 0.50 and f01 < 0.60 ? #ccccff :
         f01 >= 0.60 and f01 < 0.70 ? #cc99ff :
         f01 >= 0.70 and f01 < 0.80 ? #cc66ff :
         f01 >= 0.80 and f01 < 0.90 ? #cc33ff :
         f01 >= 0.90 and f01 < 1.00 ? #cc00ff :
         black
t02_color = f02 >= 0.00 and f02 < 0.10 ? #336699 :
         f02 >= 0.10 and f02 < 0.20 ? #0099cc :
         f02 >= 0.20 and f02 < 0.30 ? #00ccff :
         f02 >= 0.30 and f02 < 0.40 ? #33ccff :
         f02 >= 0.40 and f02 < 0.50 ? #66ccff :
         f02 >= 0.50 and f02 < 0.60 ? #ccccff :
         f02 >= 0.60 and f02 < 0.70 ? #cc99ff :
         f02 >= 0.70 and f02 < 0.80 ? #cc66ff :
         f02 >= 0.80 and f02 < 0.90 ? #cc33ff :
         f02 >= 0.90 and f02 < 1.00 ? #cc00ff :
         black
t03_color = f03 >= 0.00 and f03 < 0.10 ? #336699 :
         f03 >= 0.10 and f03 < 0.20 ? #0099cc :
         f03 >= 0.20 and f03 < 0.30 ? #00ccff :
         f03 >= 0.30 and f03 < 0.40 ? #33ccff :
         f03 >= 0.40 and f03 < 0.50 ? #66ccff :
         f03 >= 0.50 and f03 < 0.60 ? #ccccff :
         f03 >= 0.60 and f03 < 0.70 ? #cc99ff :
         f03 >= 0.70 and f03 < 0.80 ? #cc66ff :
         f03 >= 0.80 and f03 < 0.90 ? #cc33ff :
         f03 >= 0.90 and f03 < 1.00 ? #cc00ff :
         black
t04_color = f04 >= 0.00 and f04 < 0.10 ? #336699 :
         f04 >= 0.10 and f04 < 0.20 ? #0099cc :
         f04 >= 0.20 and f04 < 0.30 ? #00ccff :
         f04 >= 0.30 and f04 < 0.40 ? #33ccff :
         f04 >= 0.40 and f04 < 0.50 ? #66ccff :
         f04 >= 0.50 and f04 < 0.60 ? #ccccff :
         f04 >= 0.60 and f04 < 0.70 ? #cc99ff :
         f04 >= 0.70 and f04 < 0.80 ? #cc66ff :
         f04 >= 0.80 and f04 < 0.90 ? #cc33ff :
         f04 >= 0.90 and f04 < 1.00 ? #cc00ff :
         black
t05_color = f05 >= 0.00 and f05 < 0.10 ? #336699 :
         f05 >= 0.10 and f05 < 0.20 ? #0099cc :
         f05 >= 0.20 and f05 < 0.30 ? #00ccff :
         f05 >= 0.30 and f05 < 0.40 ? #33ccff :
         f05 >= 0.40 and f05 < 0.50 ? #66ccff :
         f05 >= 0.50 and f05 < 0.60 ? #ccccff :
         f05 >= 0.60 and f05 < 0.70 ? #cc99ff :
         f05 >= 0.70 and f05 < 0.80 ? #cc66ff :
         f05 >= 0.80 and f05 < 0.90 ? #cc33ff :
         f05 >= 0.90 and f05 < 1.00 ? #cc00ff :
         black
t06_color = f06 >= 0.00 and f06 < 0.10 ? #336699 :
         f06 >= 0.10 and f06 < 0.20 ? #0099cc :
         f06 >= 0.20 and f06 < 0.30 ? #00ccff :
         f06 >= 0.30 and f06 < 0.40 ? #33ccff :
         f06 >= 0.40 and f06 < 0.50 ? #66ccff :
         f06 >= 0.50 and f06 < 0.60 ? #ccccff :
         f06 >= 0.60 and f06 < 0.70 ? #cc99ff :
         f06 >= 0.70 and f06 < 0.80 ? #cc66ff :
         f06 >= 0.80 and f06 < 0.90 ? #cc33ff :
         f06 >= 0.90 and f06 < 1.00 ? #cc00ff :
         black
t07_color = f07 >= 0.00 and f07 < 0.10 ? #336699 :
         f07 >= 0.10 and f07 < 0.20 ? #0099cc :
         f07 >= 0.20 and f07 < 0.30 ? #00ccff :
         f07 >= 0.30 and f07 < 0.40 ? #33ccff :
         f07 >= 0.40 and f07 < 0.50 ? #66ccff :
         f07 >= 0.50 and f07 < 0.60 ? #ccccff :
         f07 >= 0.60 and f07 < 0.70 ? #cc99ff :
         f07 >= 0.70 and f07 < 0.80 ? #cc66ff :
         f07 >= 0.80 and f07 < 0.90 ? #cc33ff :
         f07 >= 0.90 and f07 < 1.00 ? #cc00ff :
         black
t08_color = f08 >= 0.00 and f08 < 0.10 ? #336699 :
         f08 >= 0.10 and f08 < 0.20 ? #0099cc :
         f08 >= 0.20 and f08 < 0.30 ? #00ccff :
         f08 >= 0.30 and f08 < 0.40 ? #33ccff :
         f08 >= 0.40 and f08 < 0.50 ? #66ccff :
         f08 >= 0.50 and f08 < 0.60 ? #ccccff :
         f08 >= 0.60 and f08 < 0.70 ? #cc99ff :
         f08 >= 0.70 and f08 < 0.80 ? #cc66ff :
         f08 >= 0.80 and f08 < 0.90 ? #cc33ff :
         f08 >= 0.90 and f08 < 1.00 ? #cc00ff :
         black
t09_color = f09 >= 0.00 and f09 < 0.10 ? #336699 :
         f09 >= 0.10 and f09 < 0.20 ? #0099cc :
         f09 >= 0.20 and f09 < 0.30 ? #00ccff :
         f09 >= 0.30 and f09 < 0.40 ? #33ccff :
         f09 >= 0.40 and f09 < 0.50 ? #66ccff :
         f09 >= 0.50 and f09 < 0.60 ? #ccccff :
         f09 >= 0.60 and f09 < 0.70 ? #cc99ff :
         f09 >= 0.70 and f09 < 0.80 ? #cc66ff :
         f09 >= 0.80 and f09 < 0.90 ? #cc33ff :
         f09 >= 0.90 and f09 < 1.00 ? #cc00ff :
         black
t10_color = f10 >= 0.00 and f10 < 0.10 ? #336699 :
         f10 >= 0.10 and f10 < 0.20 ? #0099cc :
         f10 >= 0.20 and f10 < 0.30 ? #00ccff :
         f10 >= 0.30 and f10 < 0.40 ? #33ccff :
         f10 >= 0.40 and f10 < 0.50 ? #66ccff :
         f10 >= 0.50 and f10 < 0.60 ? #ccccff :
         f10 >= 0.60 and f10 < 0.70 ? #cc99ff :
         f10 >= 0.70 and f10 < 0.80 ? #cc66ff :
         f10 >= 0.80 and f10 < 0.90 ? #cc33ff :
         f10 >= 0.90 and f10 < 1.00 ? #cc00ff :
         black

plotcandle(l, l, l, l+fraction*1, color=t01_color)
plotcandle(l+fraction*1, l+fraction*1, l+fraction*1, l+fraction*2, color=t02_color)
plotcandle(l+fraction*2, l+fraction*2, l+fraction*2, l+fraction*3, color=t03_color)
plotcandle(l+fraction*3, l+fraction*3, l+fraction*3, l+fraction*4, color=t04_color)
plotcandle(l+fraction*4, l+fraction*4, l+fraction*4, l+fraction*5, color=t05_color)
plotcandle(l+fraction*5, l+fraction*5, l+fraction*5, l+fraction*6, color=t06_color)
plotcandle(l+fraction*6, l+fraction*6, l+fraction*6, l+fraction*7, color=t07_color)
plotcandle(l+fraction*7, l+fraction*7, l+fraction*7, l+fraction*8, color=t08_color)
plotcandle(l+fraction*8, l+fraction*8, l+fraction*8, l+fraction*9, color=t09_color)
plotcandle(l+fraction*9, l+fraction*9, l+fraction*9, h, color=t10_color)