커뮤니티
예스랭귀지 Q&A
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1311
글번호 230811
답변완료
질문 부탁드립니다
수고하십니다
질문 몇 가지 부탁드립니다
질문1)
if Bdate != Bdate[1] Then
Condition3 = False;
if condition3==False and countif(h>aa[0] and h>aa[1]...and h>aa[20],50)>1 Then
{
condition3=true;
find(1)
}
위의 식에서 h>aa[0] and h>aa[1]...and h>aa[20] 처럼 길어질때 반복문으로 검색식을 만들수 있을까요
질문2)
if (h>l*1.08) then
{
...
condition1=false;
if countif(h>aa[0] and h>aa[1]...and h>aa[20],50)>1 Then condition1=true;
}
countif(h>aa[0] and ...h>aa[20],50)>1 을 condition1 에 포함시키고자 하는데
반복문으로 만들고 싶습니다
질문3)
텍스트 관련 질문인데요
newline 을 변수화 하려고 하는데요
예를들어
nl=newline;
txt1[0]=text_new(sd[0],st[0],aa[0],nl+NumToStr(h,0)+nl+NumToStr(h,0)+nl+NumToStr(l,0)));
이렇게 표현하고자 하는데 연산자 앞뒤 두 데이터의 형태가 같아야 합니다 라는 에러가 나오네요. newline 은 변수에 대입이 안되나요?
그리고
text_setstring 에서요
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
sd[cnt] =sd[cnt-1];st[cnt] =st[cnt-1];
txt1[cnt]=txt1[cnt-1];
Text_SetString(txt1[cnt],newline+NumToStr(cnt,0));
}
aa[0] = value1;
sd[0] = sDate;
st[0] = sTime;
txt1[0]=text_new(sd[0],st[0],aa[0],newline+NumToStr(aa[cnt],0)
+newline+NumToStr(sd[cnt],0)+newline+
NumToStr(cnt,0));
text_setstring() 안에 txt1 의 내용 전체가 들어가야 모든 조건만족봉에서
텍스트가 나타나기에, (위 식처럼 하면 가장 최근봉에만 표시됨)
txt1 내용이 바뀔때마다 매번 setstring 내용도 같이 변경을 해줘야하는데요
혹시
var1=newline+NumToStr(aa[cnt],0)+newline+NumToStr(sd[cnt],0)+newline+NumToStr(cnt,0);
for cnt=49 downto 1
{
txt1[cnt]=txt1[cnt-1];
Text_SetString(txt1[cnt],var1);
}
txt1[0]=text_new(sd[0],st[0],aa[0],var1);
이런 흐름으로 텍스트 함수 내용의 일부를 변수화 시킬 수있을까요?
일반 변수가 안된다면 논리형 변수로 할 수 있을까요?
감사합니다
2025-06-11
390
글번호 191594
답변완료
수식 부탁드립니다
지표식 부탁드립니다.
//@version=5
indicator("SR MA", overlay = true, timeframe = "", timeframe_gaps = false)
// Simple filter function
simple_filter(float source, int length, bool duel_filter) =>
switch duel_filter
false => ta.wma(source, length)
true => ta.wma(ta.sma(source, length), length)
// Main SR MA function
sr_ma(float source = close, int output_smoothing = 3, int trigger_smoothing = 1, int atr_length = 50, float multiplier = 1, string range_switch = "Body", bool duel_filter = false) =>
candle_top = range_switch != "Body" ? high : math.max(open, close)
candle_bottom = range_switch != "Body" ? low : math.min(open, close)
smooth_top = ta.sma(candle_top, trigger_smoothing)
smooth_bottom = ta.sma(candle_bottom, trigger_smoothing)
tr = candle_top - candle_bottom
atr = ta.sma(tr, atr_length)
var float sr_ma = na
var float current_range = na
var float top_range = na
var float bottom_range = na
flag = smooth_top > top_range or smooth_bottom < bottom_range or na(current_range)
if flag
sr_ma := source
current_range := atr * multiplier
top_range := sr_ma + current_range
bottom_range := sr_ma - current_range
out = simple_filter(sr_ma, output_smoothing, duel_filter)
smooth_top_range = simple_filter(top_range, output_smoothing, duel_filter)
smooth_bottom_range = simple_filter(bottom_range, output_smoothing, duel_filter)
[out, smooth_top_range, smooth_bottom_range]
// === Inputs ===
source = input.source(close, "Source", group = "Settings")
output_smoothing = input.int(100, "Length", minval = 0, group = "Settings") + 1
use_double = input.bool(true, "Double Filter", group = "Settings")
smoothing = input.int(4, "Trigger Smoothing", minval = 0, group = "Settings") + 1
atr_length = input.int(200, "ATR Length", minval = 1, group = "Settings")
multiplier = input.float(6, "Range Multiplier", minval = 0, step = 0.125, group = "Settings")
range_switch = input.string("Body", "Range Style", ["Body", "Wick"], group = "Settings")
// === Color Inputs ===
bullish_color = input.color(color.rgb(33, 255, 120), "Bullish Color", group = "Color")
bearish_color = input.color(color.rgb(255, 33, 33), "Bearish Color", group = "Color")
neutral_color = input.color(color.rgb(137, 137, 137), "Neutral Color", tooltip = "This doubles as the solid color.", group = "Color")
// === Calculate SR MA & Ranges ===
[sr_ma, top_range, bottom_range] = sr_ma(source, output_smoothing, smoothing, atr_length, multiplier, range_switch, use_double)
// === MA Color Logic ===
ma_delta_neutral = sr_ma - nz(sr_ma[1]) == 0
ma_delta_bullish = sr_ma - nz(sr_ma[1]) > 0
ma_delta_bearish = sr_ma - nz(sr_ma[1]) < 0
ma_color = ma_delta_neutral ? neutral_color : ma_delta_bullish ? bullish_color : bearish_color
// === Plot SR MA and Ranges ===
alpha = color.new(color.red, 100)
ma = plot(sr_ma, "SR MA", ma_color, 4)
top = plot(top_range, "Top Range", ma_color, 2)
bottom = plot(bottom_range, "Bottom Range", ma_color, 2)
fill(ma, top, top_value = top_range, bottom_value = sr_ma, bottom_color = color.new(ma_color, 80), top_color = alpha)
fill(ma, bottom, top_value = sr_ma, bottom_value = bottom_range, top_color = color.new(ma_color, 80), bottom_color = alpha)
// === Detect Color Change ===
var color prev_color = na
color_change = ma_color != prev_color and not na(prev_color)
prev_color := ma_color
color_change_to_bullish = color_change and ma_color == bullish_color
color_change_to_bearish = color_change and ma_color == bearish_color
// === Visual Markers ===
plotshape(color_change_to_bullish, title="MA Color Change to Bullish", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small, text="Bullish")
plotshape(color_change_to_bearish, title="MA Color Change to Bearish", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small, text="Bearish")
// === Alerts for Color Changes ===
alertcondition(color_change_to_bullish, title="SR MA Color Changed to Bullish", message="SR MA color changed to Bullish (Uptrend)")
alertcondition(color_change_to_bearish, title="SR MA Color Changed to Bearish", message="SR MA color changed to Bearish (Downtrend)")
2025-06-11
452
글번호 191593
답변완료
전략 수식 부탁드립니다
안녕하세요, 전략 수식 부탁드립니다. 감사합니다.
매수 조건
1. 종가가 5~10봉 (변수로 사용) 최저점을 하락돌파
2. 1번 기준이 만족되면 기준봉의 Low는 지지선, 중간값은 저항선으로 기록 (Condition 저점돌파가 True로 바뀜)
3. 저점돌파가 True 일때, 5~10봉 (변수로 사용) 이내 가격이 기록된 지지선과 저항선 사이에 있고
4. 그 이후 가격이 저항선을 상승돌파하면 매수 (예: 10봉 동안 가격이 지지선과 저항선 사이에서 머무르다 11봉 때 저항선 상승돌파하면 매수)
매도 조건
1. 종가가 5~10봉 (변수로 사용) 최고점을 상승돌파
2. 1번 기준이 만족되면 기준봉의 High는 지지선, 중간값은 저항선으로 기록 (Condition 고점돌파가 True로 바뀜)
3. 고점돌파가 True 일때, 5~10봉 (변수로 사용) 이내 가격이 기록된 지지선과 저항선 사이에 있고
4. 그 이후 가격이 저항선을 하락돌파하면 매도 (예: 10봉 동안 가격이 지지선과 저항선 사이에서 머무르다 11봉 때 저항선 하락돌파하면 매도)
2025-06-11
309
글번호 191592
답변완료
문의 드립니다.
안녕하세요 ~
평소 많은 도움 주셔서 감사합니다.
현재 가격이 아래의 2가지, 신호와 라인을 돌파할 때 검색식 부탁드립니다.
1. 신호
BOpen =LinearRegressionValue(O, LinReg_Length,0);
BHigh = LinearRegressionValue(H, LinReg_Length,0);
BLow =LinearRegressionValue(L, LinReg_Length,0);
BClose =LinearRegressionValue(C, LinReg_Length,0);
A=MA(BClose, Signal_Length);
CROSSUP(BClose,A) && bclose>bopen && C>O
지표변수 : LinReg_Length 11
Signal_Length 7
2. 라인
A=avg(c,17);
ATR=avg(max(max(h-L,abs(c(1)-h)),abs(c(1)-L)),17);
B=ATR*2;
D=A+B;
E=Bbandsup(17,2);
e1=crossup(E,D);
e2=crossdown(E,D);
e3=crossdown(c,E);
valuewhen(1,e1 or e2 or e3,o)
감사합니다.
2025-06-10
309
글번호 191591
답변완료
복합장에서의 dayindex
복합장에서 dayindex 함수는 어떻게 작동하나요?
if dayindex == 0 then buy();
위 수식을 복합장 1분봉 챠트에 적용하면 18시 1분에 매수 주문이 나가는것 아닌가요?
실제 수식을 적용해보면 매수가 나가질 않습니다.
2025-06-10
250
글번호 191590
답변완료
문의드립니다
var : tx(0);
Text_Delete(tx);
tx = Text_New(NextBarSdate,NextBarStime,NextBarOpen,NumToStr(NextBarOpen,2));
Text_SetStyle(tx,0,0);
====================
야간차트용으로 부탁드립니다
감사합니다
2025-06-10
262
글번호 191589
답변완료
오랜만에 인사드리네요 잘부탁 드립니다
input : uselow_bull(true);
input : usehigh_bear(true);
input : line_forward(8);
input : line_back(-200);
input : label_offset(8);
var : use_low_bull(0),use_high_bear(0);
var : bull_dir(False),bear_dir(False),red_bar(false),green_bar(False);
var : strong_bull_dir(False),strong_bear_dir(False),nuetral_bar(False);
var : line_price(naN),label_price(NaN);
var : is_bar_index(0),a(0),b(0),price(0);
var : bull_break(False),bear_break(False);
var : confirmed_bull_(False),bull_value(0);
var : confirmed_bear_(False),bear_value(0);
use_low_bull = IFf(uselow_bull,low,close);
use_high_bear = IFF(usehigh_bear,high,close);
bull_dir = close >= open[1];
bear_dir = close <= open[1];
red_bar = open < close;
green_bar = open > close;
strong_bull_dir = bull_dir and red_bar;
strong_bear_dir = bear_dir and red_bar;
nuetral_bar = strong_bear_dir == False and strong_bull_dir == False;
is_bar_index = index;
if is_bar_index>0 Then
{
TL_Delete(line_price);
Text_Delete(label_price);
a = close;
b = is_bar_index;
line_price = TL_new(sDate,sTime,a,NextBarSdate,NextBarStime,a);
TL_SetColor(line_price, IFf(strong_bull_dir , red ,IFf(strong_bear_dir , lime , IFf(nuetral_bar , orange, Black))));
TL_SetExtRight(line_price,true);
TL_SetExtLeft(line_price,true);
label_price = Text_new(NextBarSdate,NextBarStime,a, ntostr(a,2));
Text_SetColor(label_price,iFf(strong_bull_dir , red ,IFf(strong_bear_dir , lime , IFf(nuetral_bar , orange, Black))));
Text_SetSize(label_price,20);
}
//=================
//BEGIN Definitions
//=================
price = close;
bull_break = price > high[1]
and price > high[2]
and price > high[3]
and price > high[4]
and price > high[5]
and price > high[6]
and price > high[7]
and price > high[8]
and price > high[9]
and price > high[10]
and price > high[11]
and price > high[12]
and price > high[13]
and price > high[14];
//
confirmed_bull_ = bull_break[1] and bull_break == False;
if confirmed_bull_ == true Then
bull_value = high;
if bull_break == bull_break[1] Then
plot1(bull_value,"bull_value",iff(bull_break != bull_break[1],Black ,red));
Else
NoPlot(1);
bear_break = price < low[1]
and price < low[2]
and price < low[3]
and price < low[4]
and price < low[5]
and price < low[6]
and price < low[7]
and price < low[8]
and price < low[9]
and price < low[10]
and price < low[11]
and price < low[11]
and price < low[12]
and price < low[13]
and price < low[14];
//
confirmed_bear_ = bear_break[1] and bear_break == False;
if confirmed_bear_ == true Then
bear_value = low;
if bear_break == bear_break[1] Then
plot2(bear_value,"bear_value",iff(bear_break != bear_break[1],Black,green));
Else
NoPlot(2);
input : rsiLen(6);
input : rsiOverbought(85);
input : rsiOversold(15);
var : rsiValue(0),rsiisoverbt(False),rsiisoversld(False);
var : bear_signal(False),bull_signal(False);
var : bulllabel1(Nan),bulllabel2(nan),bullline(NaN);
var : bearlabel1(Nan),bearlabel2(nan),bearline(NaN);
rsiValue = rsi(rsiLen);
rsiisoverbt = rsiValue >= rsiOverbought;
rsiisoversld = rsiValue <= rsiOversold;
bear_signal = (bear_break[1] and bear_break == False);
bull_signal = (bull_break[1] and bull_break == False);
if bull_signal Then
{
Text_Delete(bulllabel1);
bulllabel1 = Text_New(sDate,sTime,H,"Potential bear Reversal"+NewLine+NewLine);
Text_SetColor(bulllabel1,Green);
Text_SetStyle(bulllabel1,2,1);
Text_Delete(bulllabel2);
bulllabel2 = Text_New(sDate,sTime,H,"▼");
Text_SetColor(bulllabel2,Green);
Text_SetStyle(bulllabel2,2,1);
Text_SetSize(bulllabel2,20);
}
if bull_break Then
{
TL_Delete(bullline);
bullline = TL_new(sDate,sTime,use_high_bear,NextBarSdate,NextBarStime,use_high_bear);
TL_SetExtRight(bullline,true);
TL_SetColor(bullline,Red);
}
if bear_signal then
{
Text_Delete(bearlabel1);
bearlabel1 = text_new(sDate,sTime,L,"▲");
Text_SetColor(bearlabel1,Red);
Text_SetStyle(bearlabel1,2,0);
Text_SetSize(bearlabel1,20);
Text_Delete(bearlabel2);
bearlabel2 = text_new(sDate,sTime,L,NewLine+NewLine+"Potential bull Reversal");
Text_SetColor(bearlabel2,Red);
Text_SetStyle(bearlabel2,2,0);
}
if bear_break Then
{
TL_Delete(bearline);
bearline = TL_new(sDate,sTime,use_low_bull,NextBarSdate,NextBarStime,use_low_bull);
TL_SetExtRight(bearline,true);
TL_SetColor(bearline,green);
}
var : Sell_signal(False),Buy_signal(False);
var : bull_function(False),bear_function(False),custom_signal(False);
Sell_Signal = bull_signal;
Buy_Signal = bear_signal;
bull_function = Buy_Signal;
bear_function = Sell_Signal;
custom_signal = (bull_function or bear_function);
//END CUSTOM FUNCTIONS====
// Plot BUY SELL markers
input : show_sell_signals(false);
input : show_buy_signals(false);
var : tx1(0),tx2(0);
if show_sell_signals == true and Sell_Signal == true Then
{
tx1 = text_new(sDate,sTime,H,"▼");
Text_SetColor(tx1,Red);
Text_SetStyle(tx1,2,1);
tx2 = text_new(sDate,sTime,H,"O-B"+NewLine);
Text_SetColor(tx2,Yellow);
Text_SetStyle(tx2,2,1);
}
if show_buy_signals == true and Buy_Signal == true Then
{
tx1 = text_new(sDate,sTime,L,"▲");
Text_SetColor(tx1,Lime);
Text_SetStyle(tx1,2,0);
tx2 = text_new(sDate,sTime,L,NewLine+"O-S");
Text_SetColor(tx2,Yellow);
Text_SetStyle(tx2,2,0);
}
1, 매수시스템으로 부탁드립니다
2,,, potential bull reversal 표시되는 봉에서는 강력매수 로표시부탁드려요
2025-06-10
335
글번호 191588
답변완료
문의
주간장 선물차트에 야간 선물의 저가/고가/종가/시가를 선으로 나타내고 싶고
주간옵션 챠트에 보조챠트의 저가/고가/종가/시가를 선으로 나타내고 싶습니다
감사합니다
2025-06-10
252
글번호 191584
답변완료
키움 신호를 예스트레이더 검색식으로 부탁드립니다.
수고많으십니다. 키음 신호를 예스랭귀지로 구현하고 싶습니다. 부탁드립니다.
A=Macd(short,long)-eavg(Macd(short,long),signal);
Mc1=Valuewhen(1,crossup(A,0),O);
P=Mc1-A*증폭;
Mc2=Valuewhen(1,crossdown(A,0),C);
M=Mc2+A*(-증폭);
B=If(A>0,P,M);
crossdown(B,C)
지표변수
short 12
long 26
signal 9
증폭 10
2025-06-10
262
글번호 191580