Professional Documents
Culture Documents
RSI Multitimefram
RSI Multitimefram
RSI Multitimefram
0 at
https://mozilla.org/MPL/2.0/
// � LonesomeTheBlue
//@version=4
study(title="RSI Multi Time Frame", shorttitle="RSI", max_lines_count = 500,
format=format.price, precision=2)
TimeframeU = input(defval = 'Auto', title ="Higher Time Frame", options = ['Auto',
'1', '3', '5', '10', '15', '30', '60', '120', '180', '240', '360', '480', '720',
'D', 'W', '2W', 'M', '3M', '6M', '12M'])
len = input(14, minval=1, title="Length")
src = input(close, "Source", type = input.source)
rsi_col = input(color.blue, title = "Indicator Color", type = input.color)
rsi_width = input(defval = 2, title = "Indicator Line Width", minval = 1, maxval =
4)
rsi_h_col = input(color.green, title = "Indicator HTF Color", type = input.color)
rsi_h_width = input(defval = 2, title = "Indicator HTF Line Width", minval = 1,
maxval = 4)
num_bars = input(defval = 294, title = "Number of Bars for RSI HTF", minval = 10,
maxval = 495)
// RSI HTF
var rsi_htf_lines = array.new_line(0)
var float last_rsi = na
new_htf_bar = change(time(htf)) != 0
rsi_htf = security(syminfo.tickerid, htf, rsi(src, len), lookahead = false)
if new_htf_bar
if array.size(rsi_htf_lines) >= num_bars
line.delete(array.get(rsi_htf_lines, array.size(rsi_htf_lines) - 1))
array.pop(rsi_htf_lines)
array.unshift(rsi_htf_lines, line.new(x1 = bar_index - 1 , y1 = last_rsi, x2
=bar_index - 2, y2 = last_rsi[1], color = rsi_h_col, width = rsi_h_width))
else
if array.size(rsi_htf_lines) > 0
for x = 0 to array.size(rsi_htf_lines) - 1
line.set_x1(array.get(rsi_htf_lines, x),
line.get_x1(array.get(rsi_htf_lines, x)) + 1)
line.set_x2(array.get(rsi_htf_lines, x),
line.get_x2(array.get(rsi_htf_lines, x)) + 1)