커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
5490
글번호 230811
답변완료
수식변환 부탁드립니다.
안녕하세요
수식변환 부탁드립니다.
//@version=6
indicator("카르마RSI", overlay=true, max_bars_back = 500)
// 채널 설정
int length = input.int(150, "채널 길이", group = "CHANNEL")
float channel_width = input.float(1.5, "채널 폭", step = 0.1, group = "CHANNEL")
bool mid_disp = input.bool(true, "50선", inline = "s", group = "CHANNEL")
bool fill_band = input.bool(true, "백그라운드", inline = "s", group = "CHANNEL")
color col_up = input.color(#a7abb9, "라인 색상:ㅤㅤ상단", group = "CHANNEL", inline = "Col")
color col_mid = input.color(color.gray, "중앙", group = "CHANNEL", inline = "Col")
color col_low = input.color(#a7abb9, "하단", group = "CHANNEL", inline = "Col")
// RSI 설정
int lengtht = input.int(14, "길이", inline = "rsi", group = "RSI")
color osc_col_base = input.color(color.rgb(161, 0, 182), "", inline = "rsi", group = "RSI")
int rsiOpacity = input.int(70, "RSI 선 투명도 (0~100)", minval=0, maxval=100, group="RSI")
int upper_threshold = input.int(70, "Scale", group = "RSI", inline = "rsi1")
bool show_threshold_labels = input.bool(true, "기준선 라벨 표시", group = "RSI")
bool sig_disp = input.bool(true, "Signal Line", inline = "sig")
int length_sig = input.int(14, "", inline = "sig")
color sig_line = input.color(color.rgb(255, 0, 0), "", inline = "sig")
// 채널 구조
f_log_regression(src, length) =>
float sumX = 0.0, sumY = 0.0, sumXSqr = 0.0, sumXY = 0.0
for i = 0 to length - 1
val = math.log(src[i])
per = i + 1.0
sumX += per
sumY += val
sumXSqr += per * per
sumXY += val * per
slope = (length * sumXY - sumX * sumY) / (length * sumXSqr - sumX * sumX)
intercept = (sumY - slope * sumX) / length
[slope, intercept]
[slope, intercept] = f_log_regression(close, length)
reg_start = math.exp(intercept + slope * length)
reg_end = math.exp(intercept)
deviation = ta.stdev(close, length)
upper_start = reg_start + deviation * channel_width
upper_end = reg_end + deviation * channel_width
lower_start = reg_start - deviation * channel_width
lower_end = reg_end - deviation * channel_width
var line mid_line = na
var line upper_line = na
var line lower_line = na
if na(mid_line) and mid_disp
mid_line := line.new(bar_index[length], reg_start, bar_index, reg_end, color=col_mid, style=line.style_dashed)
else
line.set_xy1(mid_line, bar_index[length], reg_start)
line.set_xy2(mid_line, bar_index, reg_end)
if na(upper_line)
upper_line := line.new(bar_index[length], upper_start, bar_index, upper_end, width=2, color=col_up)
else
line.set_xy1(upper_line, bar_index[length], upper_start)
line.set_xy2(upper_line, bar_index, upper_end)
if na(lower_line)
lower_line := line.new(bar_index[length], lower_start, bar_index, lower_end, width=2, color=col_low)
else
line.set_xy1(lower_line, bar_index[length], lower_start)
line.set_xy2(lower_line, bar_index, lower_end)
// RSI 계산
lower_threshold = 100 - upper_threshold
slope_ = (reg_start - reg_end) / length
step = (upper_end - lower_end) / (upper_threshold - lower_threshold)
rsi = ta.rsi(close, lengtht)
sma_osc = ta.sma(rsi, length_sig)
osc_col = color.new(osc_col_base, 100 - rsiOpacity)
// 시각화
polyline_disp(float src, bool display, bool shadow = true, color_, width = 1) =>
if barstate.islast and display
points = array.new<chart.point>()
for i = 0 to length - 1
val = src[i] - lower_threshold
lower = lower_end + slope_ * i
cp = chart.point.from_index(bar_index[i], lower + step * val)
array.push(points, cp)
p1 = polyline.new(points, line_color=color_, closed=false, force_overlay=true, line_width=width)
polyline.delete(p1[1])
if shadow
label.delete(label.new(bar_index, lower_end + step * (src - lower_threshold), "कर्म RSI: " + str.tostring(src, "#.##"), style=label.style_label_left, color=color(na), textcolor=chart.fg_color)[1])
if show_threshold_labels
label.delete(label.new(bar_index, lower_end, str.tostring(lower_threshold, " ##.#"), style=label.style_label_left, color=color(na), textcolor=chart.fg_color)[1])
label.delete(label.new(bar_index, upper_end, str.tostring(upper_threshold, " ##.#"), style=label.style_label_left, color=color(na), textcolor=chart.fg_color)[1])
// 배경
if fill_band
linefill.new(upper_line, lower_line, color.new(osc_col, 95))
// Plot
polyline_disp(rsi, true, true, osc_col, 4)
polyline_disp(sma_osc, sig_disp, false, sig_line, 2)
2025-06-05
714
글번호 191467
고도산 님에 의해서 삭제되었습니다.
2025-06-07
218
글번호 191466
답변완료
질문 부탁드립니다
수고하십니다
몇 가지 여쭤보겠습니다
질문1)
aa[cnt]<h*1.15 and aa[cnt]>l*0.85
조건에 해당되는 aa[ ] 배열값을
ab[ ] 배열에 순서대로 넣으려고 하는데요
값이 제대로 안들어가는거 같네요
예를들어 aa[3], aa[5] 가 조건에 해당되면
ab[0] 에 aa[3] 값이, ab[1] 에 aa[5] 값이 들어가게 하려고 합니다
혹시 첫번째 for 문에서 aa[cnt] 에 사용됐던 cnt 변수가 이후에 중복 사용되면서 발생하는 문제일까요? cnt 대신 다른 변수를 사용했는데도 배열에 값이 안들어가긴 합니다
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
}
aa[0] = value1;
For cnt=0 to 15
{
ab[cnt]=0;
}
For cnt=0 to 5
{
if aa[cnt]<h*1.15 and aa[cnt]>l*0.85 Then
{
For cns= 0 to 15
{
ab[cns]=aa[cnt];}
}
}
질문2)
질문2번 3번 수식은 가장 아래에 첨부했습니다
(작성한 식이 x가 0~3일때 각 경우의 갯수를 구하고 그 중에서 최대값을 구하는 식이 맞죠?)
수식에서 aa[x] 값 (value4) 을 배열 ac[] 에 넣으려고 합니다
아래와 같이 작성하면 될까요??
value4 에 aa[x] 값을 저장한다음에 배열에 넣기 때문에
For cnt = 49 DownTo 1
{
ac[cnt] = ac[cnt-1];
}
ac[0]=value4;
를 가장 아래에 다시 작성하는게 맞을까요?
그리고
aa[cnt]=aa[cnt-1]; 할때 cnt 를 썼기 때문에
밑에서 x 를 사용한것 처럼 cnt와는 다른 변수를 사용해야되는게 맞나요??
밑에서도 aa[] 에 cnt 를 쓰면 충돌을 하게 되나요?
질문3)
혹시 아래와 같이 작성해도 같은 의미가 되나요?
For cnt = 49 DownTo 1
{
For x = 0 to 3
{
For y = 1 to (id[0]-id[1])
{
if h[y]>aa[x] and l[y]<aa[x] then
value2 = value2+1;
}
if Value3 == 0 or (Value3 > 0 and Value2 > Value3) Then
{
Value3 = Value2;
Value4 = aa[x];
}
}
ac[cnt] = ac[cnt-1];
}
ac[0]=value4;
감사합니다
아래는 수식입니다
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
ac[cnt] = ac[cnt-1];
}
aa[0] = value1;
ac[0]=value4;
Value2 = 0;
Value3 = 0;
Value4 = 0;
For x = 0 to 3
{
For y = 1 to (id[0]-id[1])
{
if h[y]>aa[x] and l[y]<aa[x] then
value2 = value2+1;
}
if Value3 == 0 or (Value3 > 0 and Value2 > Value3) Then
{
Value3 = Value2;
Value4 = aa[x];
}
}
2025-06-09
483
글번호 191465
yamu 님에 의해서 삭제되었습니다.
2025-06-05
1
글번호 191464
답변완료
조건검색식 문의드립니다.
input : 기간(200),a(70),b(11);
var : hull(0);
hull = WMa(WMa(c,기간/2)*2 - WMa(c, 기간), floor(sqrt(기간)));
if CrossUp(C,EnvelopeDown(a,b)) Then
var1 = O;
if sDate != sDate[1] Then
var2 = 0;
if CrossDown(hull,var1) Then
var2 = var2+1;
if var2 >= 1 and c > var1 and C <= var1*1.15 Then
Find(1);
위 수식은 일전에 만들어준 수식인데,
위 수식에서
b=ValueWhen(1,(crossup(c,envelopedown(a,b))),L);
위 지표라인으로 해당 부분을 변경(대체) 해주시면 감사드리겠습니다(___)
2025-06-05
386
글번호 191456
답변완료
부탁드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input(50)
float factor = input.float(1.0, "Factor", step = 0.1)
// Color
color col_up = input(color.lime, "", inline = "col")
color col_dn = input(color.rgb(221, 26, 26), "", inline = "col")
color col_ul = input(color.aqua, "", inline = "col")
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
trend(length)=>
var direction = 0
var count_up = 0.
var count_dn = 0.
float volatility = ta.sma(high-low, 70) * factor
float upper = ta.highest(ta.sma(close, 25) + volatility, int(length/2))
float lower = ta.lowest(ta.sma(close, length) - volatility, int(length/2))
bool sig_up = ta.crossover(hlc3, upper) and barstate.isconfirmed
bool sig_dn = ta.crossunder(hlc3, lower) and barstate.isconfirmed
switch
sig_up => direction := 1
sig_dn => direction := -1
upper := direction == 1 ? float(na) : upper
lower := direction == -1 ? float(na) : lower
// Trends Duration
if direction == 1
count_up += 0.5
count_dn := 0
if direction == -1
count_dn += 0.5
count_up := 0
count_up := count_up > 70 ? 70 : count_up
count_dn := count_dn > 70 ? 70 : count_dn
[upper, lower, direction, count_up, count_dn]
[upper, lower, direction, count_up, count_dn] = trend(length)
float upper_band = lower + ta.atr(100)*5
float lower_band = upper - ta.atr(100)*5
color upper_col = color.new(col_dn, int(count_dn))
color lower_col = color.new(col_up, int(count_up))
color upper_band_col = color.new(col_ul, 70 - int(count_up))
color lower_band_col = color.new(col_ul, 70 - int(count_dn))
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
plot(upper_band, "Upper Wave", style = plot.style_linebr, color = bar_index % 2 == 0 ? na : upper_band_col, linewidth = 1)
plot(lower_band, "Lower Wave", style = plot.style_linebr, color = bar_index % 2 == 0 ? na : lower_band_col, linewidth = 1)
plot(upper, "Upper Band", style = plot.style_linebr, color = upper_col, linewidth = 2)
plot(lower, "Lower Band", style = plot.style_linebr, color = lower_col, linewidth = 2)
plot(upper, "Upper Band Shadow", style = plot.style_linebr, color = color.new(col_dn, int(count_dn*2)), linewidth = 6)
plot(lower, "Lower Band Shadow", style = plot.style_linebr, color = color.new(col_up, int(count_up*2)), linewidth = 6)
plotshape(direction != direction[1] and direction == 1 ? lower : na, "Trend Up", shape.circle, location.absolute, size = size.tiny, color = col_up)
plotshape(direction != direction[1] and direction == 1 ? lower : na, "Trend Up", shape.circle, location.absolute, size = size.small, color = color.new(col_up, 70))
plotshape(direction != direction[1] and direction == -1 ? upper : na, "Trend Down", shape.circle, location.absolute, size = size.tiny, color = col_dn)
plotshape(direction != direction[1] and direction == -1 ? upper : na, "Trend Down", shape.circle, location.absolute, size = size.small, color = color.new(col_dn, 70))
// Trend Duration (70 max)
// if barstate.islast
// if direction == 1
// label.delete(label.new(bar_index, lower, str.tostring(count_up), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1])
// if direction == -1
// label.delete(label.new(bar_index, upper, str.tostring(count_dn), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1])
// }
2025-06-05
473
글번호 191449
답변완료
조건검색식 문의드립니다.
첫번째 수식 문의
이동 = ma(C, 20);
이동1 = ma(C, 200);
조건 = CrossUp(이동, 이동1);
라인 = Valuewhen(1, 조건, (H + L) / 1.95);
신호 = 라인 != Ref(라인, 1);
2번째 수식 문의
신=H-L;
호=MAX(C,O)-L;
조건=신/호>2 && H/C(1)>1.05;
기준선=valuewhen(1,조건,H);
신호=crossup(C, 기준선);
당일 장중에 30분봉 상에서, 위 신호가 뜬 종목에 대해서
다 검출할 수 있도록 해주시면 감사드리겠습니다.
종가 기준으로 신호가 뜬 자리가 아닌, 당일 장중에라도 위 신호가 발생 된 종목을 검출하고 싶습니다.
검색식은
첫번째 문의 1개
두번째 문의 1개 각각 부탁드리겠습니다!
감사드립니다(__)
2025-06-05
360
글번호 191442
답변완료
문의드립니다
야간선물용으로 지표를 만들때
(야간시간: 18시 ~ 다음날 6시)
StartTime(180000),EndTime(055000);
이렇게 표시하면 될까요?
아니면 endtime을 빼고 startime만 넣어도 자정넘어 다음날까지 지표출력이 될까요?
2025-06-05
325
글번호 191441
답변완료
수식 문의드립니다.
안녕하세요.
기존 사용하는 수식에 덧붙여서 사용할 수 있는 수식 부탁드립니다.
매수진입/매도진입 이후에 3분이 지나도록 손실구간에 있을 경우에는 자동 청산되도록 하는 수식을 부탁드리겠습니다.
항상 감사드립니다.
2025-06-05
347
글번호 191439