답변완료
수식검토
아래 수식에 문제가 없는지만 봐주세요. 계속 검색에 하나도 안나와서요.
(하이킨아시 차트기준:
1.음봉(-2봉), 양봉(-1봉), 양봉(0봉)
2.2봉전 저가가 BOL(20,2)하한선이하
3.2봉전 RSI(20)<30, 0봉전 RSI(20)>30)
============================================================================
var : haC(0),haO(0),haH(0),haL(0);
var : mav(0),sdv(0),B(0);
var : A(0),A1(0);
#Heiken Ashi 시고저종
if index == 0 then
{
haC = (O+H+L+C)/4;
haO = open;
haH = MaxList( high, haO, haC);
haL = MinList( low, haO,haC);
}
else
{
haC = (O+H+L+C)/4;
haO = (haO [1] + haC [1])/2 ;
haH = MaxList(High, haO, haC) ;
haL = MinList(Low, haO, haC) ;
}
A=(haO+haH+haL+haC)/4;
A1=(haC[1]+haO[1])/2;
mav = ma(hac,20);
sdv = std(hac,20);
B = mav-sdv*2;
Inputs: Length(20);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0),haRSI(0);
If Index == Length Then Begin
UpSum = 0;
DownSum = 0;
For Counter = 0 To Length - 1 Begin
UpAmt = haC[Counter] - haC[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else Begin
DownAmt = -UpAmt;
UpAmt = 0;
End;
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
End;
UpAvg = UpSum / Length;
DownAvg = DownSum / Length;
End
Else If Index > length AND Length > 0 Then Begin
UpAmt = haC[0] - haC[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else Begin
DownAmt = -UpAmt;
UpAmt = 0;
End;
UpAvg = (UpAvg[1] * (Length - 1) + UpAmt) / Length;
DownAvg = (DownAvg[1] * (Length - 1) + DownAmt) / Length;
End;
If UpAvg + DownAvg <> 0 Then
haRSI = 100 * UpAvg / (UpAvg + DownAvg);
Else
haRSI = 0;
if haC[2] < HaO[2] and HaC[1] > HaO[1] and HaC > HaO and
haRSI[2] < 30 and haRSI > 30 and
haL[2] < B[2] then
Find(1);
2025-09-02
140
글번호 193677
종목검색
답변완료
조건검색식 문의드립니다.
//@version=5
indicator("RSI Shift Zone [ChartPrime] with Custom Line Width and Breakout Signals", overlay = false, max_labels_count = 500)
// --------------------------------------------------------------------------------------------------------------------{
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")
display_rsi_val = input.bool(false, "Display RSI Values at the Zones")
show_breakout_signals = input.bool(true, "Show Breakout Signals") // 신호 표시 여부 설정
// Line Width Inputs
upper_line_width = input.int(3, "Upper Line Width", minval=1, maxval=5)
lower_line_width = input.int(3, "Lower Line Width", minval=1, maxval=5)
center_line_width = input.int(2, "Center Line Width", minval=1, maxval=5)
upper_col = input.color(#21c997, "↑", inline = "colors")
lower_col = input.color(#cc24e2, "↓", inline = "colors")
center_line_col = input.color(color.gray, "Center Line Color")
breakout_col = input.color(color.green, "Breakout Signal Color") // 돌파 신호 색상
var start = int(na)
var trigger = false
var float upper = na
var float lower = na
var channel_color = color(na)
var bool is_lower_channel = na // 하단 채널인지 여부를 저장하는 변수 추가
color bar_color = na
// --------------------------------------------------------------------------------------------------------------------{
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
label.new(bar_index, rsi, style = label.style_circle, size = size.tiny, color = color.new(rsi_color, 45))
label.new(bar_index, rsi, str.tostring(upper_level), style = label.style_label_center, size = size.small, color = color.new(rsi_color, 100))
start := bar_index
trigger := true
upper := high
lower := low
channel_color := rsi_color
bar_color := rsi_color
is_lower_channel := false // 상단 채널임을 표시
if display_rsi_val
label.new(bar_index, hl2, "RSI: " + str.tostring(upper_level), style = label.style_label_right, color = color.new(rsi_color, 100), textcolor = color.white, size = size.small)
if channel_lower
label.new(bar_index, rsi, style = label.style_circle, size = size.tiny, color = color.new(rsi_color, 45))
label.new(bar_index, rsi, str.tostring(lower_level), style = label.style_label_center, size = size.small, color = color.new(rsi_color, 100))
start := bar_index
trigger := true
upper := high
lower := low
channel_color := rsi_color
bar_color := rsi_color
is_lower_channel := true // 하단 채널임을 표시
if display_rsi_val
label.new(bar_index, hl2, "RSI: " + str.tostring(lower_level), style = label.style_label_right, color = color.new(rsi_color, 100), textcolor = color.white, size = size.small)
if bar_index-start >= min_channel_len
trigger := false
trigger_change = channel_upper != channel_upper[1] or channel_lower != channel_lower[1]
// 상단선 돌파 신호 로직 수정: 하단 채널에서 생성된 박스의 상단만 돌파할 때 신호 발생
upper_breakout = not na(upper) and close > upper and show_breakout_signals and is_lower_channel
// --------------------------------------------------------------------------------------------------------------------}
// Plotting
// --------------------------------------------------------------------------------------------------------------------{
barcolor(bar_color)
prsi = plot(rsi, "RSI", color = rsi_color, linewidth = 2)
p50 = plot(50, color = color.gray, editable = false)
plower = plot(lower_level, "Lower RSI Level", color = color.gray)
pupper = plot(upper_level, "Upper RSI Level", color = color.gray)
fill(prsi, pupper, rsi >= upper_level ? color.new(rsi_color, 80) : na)
fill(prsi, plower, rsi <= lower_level ? color.new(rsi_color, 80) : na)
plot(trigger_change ? float(na) : upper, force_overlay = true, style = plot.style_linebr, offset = -1, color = channel_color, editable = false, linewidth=upper_line_width)
plot(trigger_change ? float(na) : lower, force_overlay = true, style = plot.style_linebr, offset = -1, color = channel_color, editable = false, linewidth=lower_line_width)
p1 = plot(trigger_change ? float(na) : upper, force_overlay = true, style = plot.style_linebr, color = color.new(channel_color, 70), linewidth = upper_line_width, editable = false)
p2 = plot(trigger_change ? float(na) : lower, force_overlay = true, style = plot.style_linebr, color = color.new(channel_color, 70), linewidth = lower_line_width, editable = false)
fill(p1, p2, color.new(channel_color, 90))
// 중심선 플롯
plot(trigger_change ? float(na) : math.avg(upper, lower), force_overlay = true, style = plot.style_linebr, offset = -1, color = center_line_col, editable = false, linewidth=center_line_width)
plot(trigger_change ? float(na) : math.avg(upper, lower), force_overlay = true, style = plot.style_linebr, color = center_line_col, editable = false, linewidth=center_line_width)
// 상단선 돌파 신호 표시 (하단 채널에서 생성된 박스의 상단 돌파만)
plotshape(upper_breakout, title="Upper Breakout", style=shape.triangleup, location=location.belowbar, color=breakout_col, size=size.small)
// --------------------------------------------------------------------------------------------------------------------}
일봉상 위 신호가 발생한 종목을 검출할 수 있도록 해주시면 감사드리겠습니다 (__)
항상 감사드립니다 :)
2025-09-02
109
글번호 193662
검색