커뮤니티

조건검색 문의

프로필 이미지
사공하늘
2026-01-14 15:55:47
25
글번호 229809
답변완료

//@version=5

indicator("RSI Shift Zone - Upper Breakout Only", overlay = true, max_labels_count = 500)


// --------------------------------------------------------------------------------------------------------------------

// [Inputs]

rsi_len = input.int(14, "RSI length")

upper_level = input.int(70, "Upper RSI Level", minval = 50)

lower_level = input.int(30, "Lower RSI Level", maxval = 50)

min_channel_len = input.int(15, "Minimal bars length of the channel")

rsi_filter_val = input.int(40, "Min RSI for Signal")


upper_line_width = input.int(3, "Upper Line Width")

lower_line_width = input.int(3, "Lower Line Width")

center_line_width = input.int(2, "Center Line Width")


upper_col = input.color(#21c997, "Upper Color")

lower_col = input.color(#cc24e2, "Lower Color")

center_line_col = input.color(color.gray, "Center Color")


// --------------------------------------------------------------------------------------------------------------------

// [Calculations]

var int start = na

var bool trigger = false

var float upper = na

var float lower = na

var color channel_color = color(na)

var bool is_upper_zone = false


rsi = ta.rsi(close, rsi_len)


channel_upper = ta.crossover(rsi, upper_level) and not trigger

channel_lower = ta.crossunder(rsi, lower_level) and not trigger


rsi_color = color.from_gradient(rsi, lower_level, upper_level, lower_col, upper_col)


if channel_upper

start := bar_index

trigger := true

upper := high

lower := low

channel_color := rsi_color

is_upper_zone := true


if channel_lower

start := bar_index

trigger := true

upper := high

lower := low

channel_color := rsi_color

is_upper_zone := false


if bar_index - start >= min_channel_len

trigger := false


trigger_change = (channel_upper != channel_upper[1]) or (channel_lower != channel_lower[1])


active_upper_line = trigger_change ? na : upper

active_lower_line = trigger_change ? na : lower

middle_line = trigger_change ? na : math.avg(upper, lower)


// --------------------------------------------------------------------------------------------------------------------

// [Signal Logic]

upper_breakout = ta.crossover(close, active_upper_line) and is_upper_zone and rsi > rsi_filter_val


// --------------------------------------------------------------------------------------------------------------------

// [Plotting]

plot(active_upper_line, "Upper Line", color = channel_color, style = plot.style_linebr, linewidth = upper_line_width)

plot(active_lower_line, "Lower Line", color = channel_color, style = plot.style_linebr, linewidth = lower_line_width)


p1 = plot(active_upper_line, display = display.none)

p2 = plot(active_lower_line, display = display.none)

fill(p1, p2, color.new(channel_color, 90))


plot(middle_line, "Center Line", color = center_line_col, style = plot.style_linebr, linewidth = center_line_width)


plotshape(upper_breakout, title="Upper Breakout", style=shape.triangleup, location=location.belowbar, color=upper_col, size=size.small, text="UP")


// --------------------------------------------------------------------------------------------------------------------

// [Alerts]

alertcondition(upper_breakout, title="Upper Breakout Alert", message="Price crossed Upper Shift Zone")





일봉상 위 신호가 나온 종목을 검출할 수 있도록 해주시면 감사드리겠습니다 (__)

검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-01-15 11:06:44

안녕하세요 예스스탁입니다. input : rsi_len(14); input : upper_level(70); input : lower_level(30); input : min_channel_len(15); input : rsi_filter_val(40); var : start(Nan); var : trigger(False); var : upper(Nan); var : lower(Nan); var : is_upper_zone(false); var : R(0),channel_upper(False),channel_lower(False); var : trigger_change(False),active_upper_line(0),active_lower_line(0); var : middle_line(0),upper_breakout(False); R = rsi(rsi_len); channel_upper = CrossUp(R, upper_level) and trigger == False; channel_lower = CrossDown(R, lower_level) and trigger == False; if channel_upper Then { start = index; trigger = true; upper = high; lower = low; is_upper_zone = true ; } if channel_lower Then { start = index; trigger = true; upper = high; lower = low; is_upper_zone = false ; } if index - start >= min_channel_len Then trigger = false; trigger_change = (channel_upper != channel_upper[1]) or (channel_lower != channel_lower[1]); active_upper_line = iff(trigger_change , Nan , upper); active_lower_line = iff(trigger_change , Nan , lower); middle_line = iff(trigger_change , Nan , avg(upper, lower)); upper_breakout = CrossUp(close, active_upper_line) and is_upper_zone and R > rsi_filter_val; if upper_breakout Then Find(1); 즐거운 하루되세요