커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
7669
글번호 230811
답변완료
문의드립니다.
안녕하세요.
매수 :
조건A 만족하면 2계약 시장가 매수
매수후
손절가 = 매수봉 저가
매수후 종가가 아닌 현재가가 손절가 하방 이탈시 전량 매도
절반 청산:
매수후 종가 > 매수가 만족하는 첫번째 종가에서 1계약 청산
절반청산 후 나머지 1계약 청산:
1계약 남았을 때 전봉의 저가를 종가가 아닌 현재가가 하방 이탈시
1계약 잔량 전부 매도
매도:매도 조건 B 만족시 반대논리로 부탁 드립니다.
2025-05-29
421
글번호 191273
답변완료
검색식 부탁 드려요
1. 종목 검색식 부탁합니다
M10=ma(C,10);
C>M10
2. 종목 검색식 부탁 드립니다.
R=Rsi(14);
Rs=eavg(R,9);
R>Rs
3. 종목 검색식 부탁 드립니다.
M= Macd(12,26);
Ms=eavg(M,9);
M>Ms
4. 종목 검색식 부탁 드립니다. (
S=StochasticsSlow(12,5);
Ss=eavg(S,3);
S>Ss
2025-05-29
420
글번호 191272
답변완료
문의 드립니다.
안녕하세요
항상 감사드립니다.
아래의 서식에서 추가 사항 부탁드립니다.
*손절 조건 추가
1. 손절: 10pt 하락시 손절
2. 당일 손절 발생시 더 이상의 진입 금지
**조건 추가사항은 최적화를 할 수 있도록 input에 넣어주시기 바랍니다.
# KOSPI 선물 5분봉
input: 당일진입횟수(3);
Input: chkP(5), reChkP(10), stopChk(25);
var: HH(0), LL(0), BS(0), SS(0);
var: dayChk(0);
var : TotalCount(0),PreDay(0),DayEntry(0);
TotalCount = TotalTrades;
if Bdate != Bdate[1] Then
PreDay = TotalCount[1];
DayEntry = (TotalCount-PreDay)+IFF(MarketPosition != 0,1,0);
if BarIndex == 0 then ClearDebug();
if dayindex == chkP then
{
HH = Highest(Max(C,O), chkP+1);
LL = Lowest(Min(C,O), chkP+1);
#if date == 20240612 then messageLog("--HH %.2f, LL: %.2f", HH, LL);
}
#if High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then messageLog("HH %.2f, High: %.2f", HH, High);
if DayIndex >= chkP
# and Time < 95000
and sDate == NextBarSdate
and EntryDate(0) < Date
and EntryDate(1) < Date
and DayEntry < 당일진입횟수
Then {
Buy("B1", AtStop, HH);
Sell("S1", AtStop, LL);
}
//if dayChk == 0 and High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then {
// messageLog("HH %.2f, High: %.2f", HH, High);
// dayChk = 1;
//}
if ExitDate(1) == Date
and Time < 150000
// and LatestEntryName(1) != "B2"
// and LatestEntryName(1) != "S2"
// and LatestEntryName(0) != "B2"
// and LatestEntryName(0) != "S2"
Then
{
if DayIndex < reChkP Then
{
HH = Highest(Max(C,O), DayIndex+1);
LL = Lowest(Min(C,O), DayIndex+1);
}
Else
{
HH = Highest(Max(C,O), reChkP);
LL = Lowest(Min(C,O), reChkP);
}
if DayEntry < 당일진입횟수 Then
{
Buy("B2", AtStop, HH);
Sell("S2", AtStop, LL);
}
}
if (MarketPosition == 1) Then {
if DayIndex < stopChk Then {
BS = Lowest(Min(C,O), DayIndex+1);
}
Else {
BS = Lowest(Min(C,O), stopChk);
}
ExitLong("EL", AtStop, BS);
}
if (MarketPosition == -1) Then {
if DayIndex < stopChk Then {
SS = Highest(Max(C,O), DayIndex+1);
}
Else {
SS = Highest(Max(C,O), stopChk);
}
#messageLog(" SS %.2f", SS);
ExitShort("ES", AtStop, SS);
}
var : month(0),nday(0),week(0),X(False);
month = int(date/100)-int(date/10000)*100;
nday = date - int(date/100)*100;
Week = DayOfWeek(date);
#만기일
if (month%3 == 0 and nday >= 8 and nday <= 14 and week == 4) then
{
X = true;
SetStopEndofday(151500);
}
Else#만기일아닐때
{
X = False;
SetStopEndofday(152000);
}
2025-05-29
590
글번호 191263
답변완료
질문 부탁드립니다
추세선과 for 문 관련해서 부탁드립니다
첨부된 식 else 문에서
h>var25 인 경우가 하나도 없을 때 (ii==0)
tr[0] 추세선의 시작점, 끝점, 가격값을
기존 값에서 (기존값: sd[6],st[6],aa[6],sd[3],st[3],aa[3])
각각 +1 씩 변경한 식을 작성했는데요, (설명을 위한 예시로 작성한것 입니다)
ii==0 인 상태에서 추세선 위치를 변경했을때 ii >1 이 될때까지
시작점,시작값은 기존값 +2로,
끝점,끝값은 기존값 +1로 변경하는 수식을 작성하고자 합니다.
if문의 기존 추세선 값을 바꾸면 연동돼서 바뀌게 할 수 있을까요?
범위는 뒤로 3 회 까지(즉 3번째 변경 했을때의 시작점은 +6, 끝점은 +3) 로 부탁드립니다
(3회까지 했으나 ii>1 이 아니라면 원래값을 유지)
항상 감사드립니다
var : cnt(0), sum1(0), sumi1(0),summ(0),tt(0),hh(0),ll(0),tll(0),n(0),ae(0);
var: sum2(0),sumi2(0),count(0),sumaa(0),sumai(0),avgaa(0);
var : t(0),StartBarIndex(0),dd(0),d1(0),d2(0),e1(0),e2(0),ii(0);
Array : aa[50](0),cc[50](0),ee[50](0),txt[40](0),txt1[20](0),
tr[40](0),sd[45](0),st[45](0),ad[50](0),at[50](0);
if Bdate != Bdate[1] Then
{
DD = DD+1;
}
if (h>l*1.08) and (d1 == 0 or (d1 > 0 and dd >= d1+5)) Then
{
d1 = dd;
hh = h;
var1 = Index;
Var2 = var1[1];
Var3 = Var2[1];
sum1=0; sumi1=0; sum2=0; sumi2=0;
tll=TL_NEW(sDate,sTime,100,sDate,sTime,999999);
TL_SetSize(tll,0);
TL_SetColor(tll,Gray);
For cnt = 1 to (var1-Var2)
{
sum1=sum1+l[cnt];
sumi1=sumi1+1;
}
value1=sum1/sumi1;
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];sd[cnt] =sd[cnt-1];st[cnt] =st[cnt-1];
txt[cnt] = txt[cnt-1];
tr[cnt]=tr[cnt-1];
}
aa[0] = value1;
sd[0] = sDate;
st[0] = sTime;
TL_SetExtRight(tr[3],False);
tr[0] = TL_New(sd[6],st[6],aa[6],sd[3],st[3],aa[3]);TL_SetDrawMode(tr[0],0);
TL_Delete( tr[3]);
TL_SetExtRight( tr[0],true);
TL_SetColor(tr[0],DarkGreen); TL_SetColor(tr[4],Green);
TL_SetColor(tr[5],LightGreen);TL_SetSize( tr[0],1);
ii=0;
}
Else
{
Var25=TL_GetValue(tr[0],sDate,sTime);
if h>=Var25 then
{
ii=ii+1;
#plot24(ii,"test1",Orange,Def,1);
}
if ii==0 Then
{
TL_SetBegin(tr[0],sd[7],st[7],aa[7]);
TL_SetEnd(tr[0],sd[4],st[4],aa[4]);
}
}
2025-05-29
680
글번호 191262
답변완료
수식질문
아래 수식1, 수식2, 수식3을
논리합(or)조건으로 결합하여 하나의 조건식으로 만들어 주시기 바랍니다
수식1.
var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0);
Array : diff[500](0);
A= ma(C,5);
value=C-A;
if IsNan(value) == False Then
{ if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; }
if ii >= 1 Then {SumSqrt = 0;
For cnt = 1 To ii
{SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;}
Stdevif=SquareRoot(SumSqrt/ii);
B=A+avgif-2*Stdevif;
if CrossDown(C,B) && C < O Then Find(1); }}
수식2.
var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0);
Array : diff[500](0);
A= ma(C,10);
value=C-A;
if IsNan(value) == False Then
{ if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; }
if ii >= 1 Then {SumSqrt = 0;
For cnt = 1 To ii
{SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;}
Stdevif=SquareRoot(SumSqrt/ii);
B=A+avgif-2*Stdevif;
if CrossDown(C,B) && C < O Then Find(1); }}
수식3.
var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0);
Array : diff[500](0);
A= ma(C,20);
value=C-A;
if IsNan(value) == False Then
{ if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; }
if ii >= 1 Then {SumSqrt = 0;
For cnt = 1 To ii
{SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;}
Stdevif=SquareRoot(SumSqrt/ii);
B=A+avgif-2*Stdevif;
if CrossDown(C,B) Then Find(1); }}
2025-05-29
451
글번호 191261
yamu 님에 의해서 삭제되었습니다.
2025-05-29
3
글번호 191260
답변완료
감사합니다 지표 변환 부탁드립니다
// Settings
//---------------------------------------------------------------------------------------------------------------------{
sp='         '
res = input.timeframe ( '' , 'Period        ' )
i1 = input.bool ( true , '' , inline='1', group='Swing Length')
i2 = input.bool ( true , '' , inline='2', group='Swing Length')
i3 = input.bool ( true , '' , inline='3', group='Swing Length')
l1 = input.int (60, 'Long     ', minval=1, inline='1', group='Swing Length')
l2 = input.int (30, 'Medium' , minval=1, inline='2', group='Swing Length')
l3 = input.int (10, 'Short    ', minval=1, inline='3', group='Swing Length')
cBull = input.color (#089981, 'Trendline'+sp, inline='d', group='Style' )
cBear = input.color (#f23645, '' , inline='d', group='Style'
, tooltip = 'Bullish/Bearish Trendline' )
cWickBull = input.color (#085def, 'Wick Dot' +sp, inline='w', group='Style' )
cWickBear = input.color (#ff5d00, '' , inline='w', group='Style'
, tooltip = 'Bullish/Bearish Wick' )
term = input.string('Long' , 'Term'
, options =['Long' , 'Medium', 'Short' ] )
HHLL = input.string('None' , 'HH/LL'
, options =['None','Only HH/LL','HH/LL & previous H/L'])
bg = input.bool ( false , 'Background Color' )
cc = input.bool ( false , 'Bar Color' )
//---------------------------------------------------------------------------------------------------------------------}
//LuxAlgo Defined Type
//---------------------------------------------------------------------------------------------------------------------{
type bin
line lin
float slope
bool active
chart.point cp
//---------------------------------------------------------------------------------------------------------------------}
//Variables
//---------------------------------------------------------------------------------------------------------------------{
lbi = last_bar_index
n = bar_index
INV = color(na)
//---------------------------------------------------------------------------------------------------------------------}
//Function
//---------------------------------------------------------------------------------------------------------------------{
draw(toggle, res, left, right, pos) =>
ps = term == 'Long' ? 1 : term == 'Medium' ? 2 : 3
var int trend = 0
var chart.point prevPh = chart.point.from_index(na, na)
var chart.point prevPl = chart.point.from_index(na, na)
var bn = bin.new(line(na), 0, false)
ph_ = ta.pivothigh(left, right), [tH, ph] = request.security(syminfo.tickerid, res, [time[2], ph_])
pl_ = ta.pivotlow (left, right), [tL, pl] = request.security(syminfo.tickerid, res, [time[2], pl_])
cH = ta.change(fixnan(ph))
cL = ta.change(fixnan(pl))
chH = cH != 0 and cL == 0
chL = cL != 0 and cH == 0
if toggle
if bn.active
if bn.lin.get_x2() - bn.lin.get_x1() > 5000
bn.active := false
bn.lin.delete()
else
bn.lin.set_xy2(n, bn.lin.get_y2() + bn.slope)
if chH
v = 0.
idx = 0
for i = 0 to 5000
Ti = time[i]
if high[i] > v
v := high[i]
idx := i
if Ti < tH
break
x = n - idx
c = close[idx]
if trend < 1
//HH
if v > prevPh.price and x - prevPh.index > 5 and n - prevPl.index < 5000
if pos == ps and HHLL != 'None'
label.new(x, v, color=color(na), text='HH₩n', size=size.tiny, textcolor=chart.fg_color)
if HHLL == 'HH/LL & previous H/L'
label.new(prevPh.index, prevPh.price, color=color(na), size=size.tiny, text='●', textcolor=chart.fg_color)
trend := 1
bn := bin.new(line.new(prevPl.index, prevPl.price, n, prevPl.price, color=cBull
, style= pos == 1 ? line.style_solid : pos == 2 ? line.style_dashed : line.style_dotted, width=pos == 1 ? 2 : 1)
, 0, true, chart.point.from_index(prevPl.index, prevPl.price))
else
//if bearish TL
if bn.active
slope = (v - bn.cp.price) / (x - bn.cp.index)
//if line direction is down and wick breaks line or first LH
if v < bn.lin.get_y1() + slope and (v > bn.lin.get_y2() + slope or bn.slope == 0)
priceLin = bn.lin.get_price(n-idx)
if c < priceLin
//where wick breaks last line price
if bn.slope != 0
label.new(n-idx, priceLin, style=label.style_label_center, text='●', color=color(na), textcolor=cWickBear)
//First 업데이트 line
bn.lin.set_xy2(n, v + slope*idx)
//if first Swing after line conception
if bn.slope == 0
//repeat until all close prices are below the line
stop = false
while not stop
arr = array.new<float>()
//check for inner-line breaks with close
for i = 0 to n - bn.lin.get_x1()
arr.push(close[i] - bn.lin.get_price(n-i))
highest_point = arr.max()
//if yes, 업데이트 first point to highest point
if highest_point > 0
ix = arr.indexof(highest_point)
x1 = n-ix, y1 = high[ix]
//label.new(x1, y1)
bn.cp.index := x1
bn.cp.price := y1
slope := (v - y1) / (x - x1)
bn.lin.set_xy2(n, v + slope*idx)
bn.lin.set_xy1(x1, y1)
bn.slope := slope
else
bn.lin.set_xy2(n, v + slope*idx)
bn.slope := slope
stop := true
else
bn.slope := slope
else
//if close price at Swing point breaks line
bn.active := false
prevPh.index := x
prevPh.price := v
else
if trend < 1
if close > bn.lin.get_y2()
bn.active := false
if chL
v = 10e6
idx = 0
for i = 0 to 5000
Ti = time[i]
if low[i] < v
v := low[i]
idx := i
if Ti < tL
break
x = n - idx
c = close[idx]
if trend >-1
//LL
if v < prevPl.price and x - prevPl.index > 5 and n - prevPh.index < 5000
if pos == ps and HHLL != 'None'
label.new(x, v, color=color(na), text='₩nLL', size=size.tiny, textcolor=chart.fg_color, style=label.style_label_up)
if HHLL == 'HH/LL & previous H/L'
label.new(prevPl.index, prevPl.price, color=color(na), size=size.tiny, text='●', textcolor=chart.fg_color, style=label.style_label_up)
trend :=-1
bn := bin.new(line.new(prevPh.index, prevPh.price, n, prevPh.price, color=cBear
, style= pos == 1 ? line.style_solid : pos == 2 ? line.style_dashed : line.style_dotted, width=pos == 1 ? 2 : 1)
, 0, true, chart.point.from_index(prevPh.index, prevPh.price))
else
//if bullish TL
if bn.active
slope = (v - bn.cp.price) / (x - bn.cp.index)
//if line direction is up and wick breaks line or first HL
if v > bn.lin.get_y1() + slope and (v < bn.lin.get_y2() + slope or bn.slope == 0)
priceLin = bn.lin.get_price(n-idx)
if c > priceLin
//where wick breaks last line price
if bn.slope != 0
label.new(n-idx, priceLin, style=label.style_label_center, text='●', color=color(na), textcolor=cWickBull)
//First 업데이트 line
bn.lin.set_xy2(n, v + slope*idx)
//if first Swing after line conception
if bn.slope == 0
//repeat until all close prices are above the line
stop = false
while not stop
arr = array.new<float>()
//check for inner-line breaks with close
for i = 0 to n - bn.lin.get_x1()
arr.push(bn.lin.get_price(n-i)-close[i])
deepest_point = arr.max()
//if yes, 업데이트 first point to deepest point
if deepest_point > 0
ix = arr.indexof(deepest_point)
x1 = n-ix, y1 = low[ix]
bn.cp.index := x1
bn.cp.price := y1
slope := (v - y1) / (x - x1)
bn.lin.set_xy2(n, v + slope*idx)
bn.lin.set_xy1(x1, y1)
bn.slope := slope
else
bn.lin.set_xy2(n, v + slope*idx)
bn.slope := slope
stop := true
else
bn.slope := slope
else
//if close price at Swing point breaks line
bn.active := false
prevPl.index := x
prevPl.price := v
else
if trend >-1
if close < bn.lin.get_y2()
bn.active := false
[trend, bn.lin.get_y2()]
//---------------------------------------------------------------------------------------------------------------------}
//실행
//---------------------------------------------------------------------------------------------------------------------{
[trend1, value1] = draw(i1, res, l1, 1, 1)
[trend2, value2] = draw(i2, res, l2, 1, 2)
[trend3, value3] = draw(i3, res, l3, 1, 3)
col = color(na)
if cc
col := switch close > value1
true =>
switch close > value2
true =>
if close > value3
color.new(cBull, 20)
else
color.new(cBull, 43)
=>
if close > value3
color.new(cBull, 66)
else
color.new(cBull, 89)
=>
switch close < value2
true =>
if close < value3
color.new(cBear, 20)
else
color.new(cBear, 43)
=>
if close < value3
color.new(cBear, 66)
else
color.new(cBear, 89)
//---------------------------------------------------------------------------------------------------------------------}
//Plot - Bar/Background Color
//---------------------------------------------------------------------------------------------------------------------{
plot(value1, display=display.none)
plot(value2, display=display.none)
plot(value3, display=display.none)
plot(trend1, display=display.none)
barcolor(cc ? col : na)
//Background color - close above/below value1-2-3
isValid = bg and (term == 'Long' ? i1 : term == 'Medium' ? i2 : i3)
bgcolor(isValid ? color.new(close > (term == 'Long' ? value1 : term == 'Medium' ? value2 : value3) ? cBull : cBear, 97) : na)
2025-05-28
1233
글번호 191259
답변완료
수식변환요청
다음수식 변환 부탁드립니다
A=(C-C(1))/C(1)*100>=10;
B=V>=Highest(V,기간);
S1=A && B;
M1=ma(C,period);
SS=ValueWhen(1,S1,M1);
C>SS && O< SS
감사합니다
2025-05-28
401
글번호 191258
답변완료
도움 부탁드립니다
안녕하세요
분봉이나 틱봉에 적용하고자 합니다.
2가지 방식의 검색식 부탁드립니다.
1. 15분 시가선이 있고 시가선위에 캔들이 있을때 빨강색 원표시
15분 시가선이 있고 시가선아래에 캔들이 있을때 파랑색 원표시
2. 15분 시가선이 있고 5이평선이 시가선을 크로스업 했을때 빨강색 원표시
15분 시가선이 있고 5이평선이 시가선을 크로스다운 했을때 파랑색 원표시
* 15분과 이평은 변수로 부탁드립니다.
2025-05-28
382
글번호 191257