커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1762
글번호 230811
답변완료
질문드립니다.
if t <= 0 and condition1==true Then
{
t = 1;
value1= a;
}
if t >= 0 and condition2==true Then
{
t = -1;
value1= b;
}
위와 같은 식에 의해 다음과 같이 빨간선과 파란선이 그려져왔다고 칠 때
빨강1구간-파랑1구간-빨강2구간-파랑2구간-빨강3구간-파랑3구간...
현재 구간이 파랑3구간이라면 현 위치에서 파랑2구간의 시작봉의 시가, 그리고 파랑2구간 영역전체 전개되는 캔들에 대한 최고점과 최저점을 현 위치에서 파악할 있는 수식을 부탁드립니다. 즉, 파랑3구간이 끝나고 빨강4구간이 시작된다면 빨강3구간에 대한 시가, 그리고 빨강3구간 영역전체에 전개되는 캔들의 최고점과 최저점.. 이런 방식입니다. 즉, 현재구간에서
전전구간의 정보를 알수있는 수식을 부탁드립니다.
2020-12-07
637
글번호 144463
하운드독 님에 의해서 삭제되었습니다.
2020-12-06
6
글번호 144462
답변완료
TS OHLCPeriodsAgo (Function) 의 YES 변환 문의
수고하십니다.
TS의 함수중 지정 주기의 시고저종가를 반환하는 함수입니다.
YES 초보라서 좀 어렵네요.
YES 랭귀지 함수로 변환을 부탁드립니다.
감사합니다.
inputs:
PeriodType( numericsimple ),
PeriodsAgo( numericsimple ),
oPeriodOpen( numericref ),
oPeriodHigh( numericref ),
oPeriodLow( numericref ),
oPeriodClose( numericref ) ;
variables:
var0( 0 ), sess_last_bar(false) ;
arrays:
arr0[ 4, 50 ]( -1 ) ;
sess_last_bar = sessionlastbar;
condition1 = PeriodsAgo > 50 or BarType > IFF(PeriodType<>0, PeriodType + 1, PeriodType + 2) or BarType > 4 ;
if condition1 then
begin
oPeriodOpen = -1 ;
oPeriodHigh = -1 ;
oPeriodLow = -1 ;
oPeriodClose = -1 ;
OHLCPeriodsAgo = -1 ;
end
else
begin
if PeriodType = 0 then
Condition1 = sess_last_bar[1]
else if PeriodType = 1 then
Condition1 = Date <> Date[1]
else if PeriodType = 2 then
Condition1 = DayOfWeek( Date ) < DayOfWeek( Date[1] )
else if PeriodType = 3 then
Condition1 = Month( Date ) <> Month( Date[1] )
else if PeriodType = 4 then
Condition1 = Year( Date ) <> Year( Date[1] ) ;
condition1 = CurrentBar = 1 or Condition1 ;
if condition1 then
begin
var0 = var0 - 1 ;
if var0 = -1
then var0 = 50 ;
arr0[ 1, var0 ] = O ;
arr0[ 2, var0 ] = H ;
arr0[ 3, var0 ] = L ;
arr0[ 4, var0 ] = C ;
end
else
begin
condition1 = H > arr0[ 2, var0 ] ;
if condition1 then arr0[ 2, var0 ] = H ;
condition1 = L < arr0[ 3, var0 ] ;
if condition1 then arr0[ 3, var0 ] = L ;
arr0[ 4, var0 ] = C ;
end ;
oPeriodOpen = arr0[ 1, Mod( var0 + PeriodsAgo, 51 ) ] ;
oPeriodHigh = arr0[ 2, Mod( var0 + PeriodsAgo, 51 ) ] ;
oPeriodLow = arr0[ 3, Mod( var0 + PeriodsAgo, 51 ) ] ;
oPeriodClose = arr0[ 4, Mod( var0 + PeriodsAgo, 51 ) ] ;
OHLCPeriodsAgo = 1 ;
end ;
if false then
Value1 = OHLCPeriodsAgo[1] ;
--------------------------------------------------------------------------
아래는 함수 설명입니다.
OHLCPeriodsAgo (Function)
image₩trumpet2.gif Disclaimer
The OHLCPeriodsAgo series function returns the Open, High, Low, and Close of a specified time segment, a specified number of periods ago.
Syntax
OHLCPeriodsAgo(PeriodType, PeriodsAgo, oPeriodOpen, oPeriodHigh, oPeriodLow, oPeriodClose)
Returns (Integer)
The oPeriodOpen, oPeriodHigh, oPeriodLow, and oPeriodCLose output parameters returns the Open, High, Low, and Close from a time segment. The OHLCPeriodsAgo function itself returns 1 if the specified time segment was available, and -1 if not.
Parameters
Name
Type
Description
PeriodType
Numeric
Sets the time period on which to base values (1=Day, 2=Week, 3=Month, 4=Year)
PeriodsAgo
Numeric
Sets the number of PeriodType periods ago
oPeriodOpen
Numeric
Outputs the open of the specified time segment
oPeriodHigh
Numeric
Outputs the high of the specified time segment
oPeriodLow
Numeric
Outputs the low of the specified time segment
oPeriodClose
Numeric
Outputs the close of the specified time segment
Remarks
See Multiple Output Function for more information on using output parameters to return values.
Example
Assigns to Value2 through Value5 the Open, High, Low, and Close of the last 20 weeks. Value1 is assigned a value of 1.
vars: oPeriodOpen(0), oPeriodHigh(0), oPeriodLow(0), oPeriodClose(0);
Value1 = OHLCPeriodsAgo(2, 20, oPeriodOpen, oPeriodHigh, oPeriodLow, oPeriodClose);
Value2 = oPeriodOpen;
Value3 = oPeriodHigh;
Value4 = oPeriodLow;
Value5 = oPeriodClose;
2020-12-06
965
글번호 144461
답변완료
개별요인에 의한 순 수익률 작성
타종목 참조를 활용하여,
개별종목의 순수익률을 반영한 종가를 작성하고 싶습니다.
EXCEL로는 표현을 할수 있겠는데, YL은 자기참조 표현을 잘못하겠네요.
첨부 excel의 G 행의 값처럼 표현하고 싶습니다 (첨부참조)
주종목(DATA1)에는 개별종목 (EX.삼성전자)
타종목(DATA2)에는 타종목 (EX. KOSPI 지수)
표현하고자하는 지표 : 주종목차트의 최초의 종가를 시작으로
하기 '개별순수익률'을 반영한, 주종목의 종가(CLOSE)
//======작성수식====
Input:base(1.5),Length(60), 차트상의첫종가(100);
Var:x(0),y(0),Beta(0),Alpha(0) , 개별순수익률 (0) ;
y = (C - C[1])*100/C[1]; //종목변동률
x = (data2(C) - data2(C[1]))*100/data2(C[1]); //시장변동률, data2는 코스피 또는 코스닥 지수
Beta = (ma(x*y, length) - ma(x,length) * ma(y,length)) /
(ma(x^2,length) - (ma(x,length)^2));
Alpha = ma(y,length) - (ma(x*y, length) - ma(x,length) * ma(y,length)) /
(ma(x^2,length) - (ma(x,length)^2)) * ma(x,length);
PLOTBASELINE1 (0,"0");
Plot1(Beta,"베타",iff(Beta>base,RED,BLUE));
Plot2(Alpha,"알파",iff(Alpha>base,RED,BLUE));
/*===========개별요인에 의한 순 수익률
* 종목의 주가 변화 = 종합지수 변화 + 종목의 개별요인 ---- (식-1)
종목의 개별요인 = 종목의 주가 변화 - 종합지수 변화
개별요인에 의한 순 수익률 = 주가의 수익률 - 베타 * 종합지수의 수익률 ---- (식-2)
*/
개별순수익률 = (Y -Beta* X)*0.01; // <=식-2
개별순수익주가 = ; //???? <=표현하고자하는 지표.
//------------------
2020-12-06
819
글번호 144460
답변완료
문의
아래는 미니선물 오버나잇 전략에 사용하는 청산수식입니다.
만기일(매월 둘째주 목요일)이 도래하면 작동됩니다.
수식에 1)~2) 내용을 추가해주시고 1개의 전략식에서 모두 병행하여 작동될 수 있게 해주세요.
1) everyday(옵션 만기일 제외) 대응 추가
- 15시10분 이후부터 장종료까지 진입과 청산 모두 금지
(오버나잇전략식이라 진입과 청산이 한국거래소 장종료시간과 겹칠 때가 있음
이를 피하기 위함)
2) 만기일 대응 추가
- 아래수식에 따라 "bx만기청산" 이름으로 청산된 경우 청산 후 1봉 경과 후
buy
(수작업을 통해 포지션을 이월하기 위함)
15시10분 연결차트에서 buy 포지션 청산
15시10분 차월물차트 시험에서 자동으로 전환(수작업)
15시15분 차월물차트에서 buy 포지션 진입
3) 해당일 표현 작성만 해주세요
- 선물 만기일
- 위클리 옵션 만기일
- everyday( 선물 만기일 제외)
- everyday( 위클리 옵션 만기일 제외)
*****************************************************************************
오버나잇 전략 +
var : va1(0),va2(0),va3(0);
va2 = date - int(date/100)*100;
va3 = DayOfWeek(date);
if va2 >= 8 and va2 <= 14 and
va3 == 4 then {
if sTime >= 151000 and marketposition == 1 Then
ExitLong("bx만기청산");
2020-12-06
937
글번호 144459
답변완료
정적 VI
하이투자증권 변동성완화장치 발동현황의 가격과 지표식이 아래 그림1과 2처럼 일치가 되지 않아 문의드립니다.
1. 지표식 : 일치가 되도록 부탁드립니다~~ 그리고 수평선 끝 상단에 가격(0.00%)을 적색으로 표시
2. 강조식 : 봉을 노란색, 봉 상단에 * 표시
3. 시스템식 : 분봉에서 돌파시 매수, 이탈시 매도
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : dn1(0), dn2(0), dn3(0), dn4(0), dn5(0),dn6(0),dn7(0);
var : a1(0),a2(0),b1(0),b2(0);
if o[1]==h[1]&&o[1]==l[1]&&(v[1]==0||v[1]>=1)&&v>=1 Then{
a1 = o*1.1;
b1 = o*0.9;
}
if date >= 19981207 then
{
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
up1 = int(a1/100+0.00001)*100;
up2 = int(a1/100+0.00001)*100;
up3 = int(a1/100+0.00001)*100;
up4 = int(a1/50+0.00001)*50;
up5 = int(a1/10+0.00001)*10;
up6 = int(a1/5+0.00001)*5;
up7 = int(a1/1+0.00001)*1;
}
else {
up1 = int(a1/1000+0.00001)*1000;
up2 = int(a1/500+0.00001)*500;
up3 = int(a1/100+0.00001)*100;
up4 = int(a1/50+0.00001)*50;
up5 = int(a1/10+0.00001)*10;
up6 = int(a1/10+0.00001)*10;
up7 = int(a1/1+0.00001)*1;
}
}
Else
{
up1 = int(a1/1000+0.00001)*1000;
up2 = int(a1/500+0.00001)*500;
up3 = int(a1/100+0.00001)*100;
up4 = int(a1/50+0.00001)*50;
up5 = int(a1/10+0.00001)*10;
up6 = int(a1/5+0.00001)*5;
up7 = int(a1/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If a1 >= 500000 Then
a2 = up1;
Else If a1 >= 100000 Then
a2 = iff(up2>=500000, up1, up2);
Else If a1 >= 50000 Then
a2 = iff(up3>=100000, up2, up3);
Else If a1 >= 10000 Then
a2 = iff(up4>=50000, up3, up4);
Else If a1 >= 5000 Then
a2 = iff(up5>=10000, up4, up5);
Else If a1 >= 1000 Then
a2 = iff(up5>=5000, up5, up6);
Else
a2 = iff(up6>=1000, up6, up6);
}
Else
{
If a1 >= 500000 Then
a2 = up1;
Else If a1 >= 100000 Then
a2 = iff(up2>=500000, up1, up2);
Else If a1 >= 50000 Then
a2 = iff(up3>=100000, up2, up3);
Else If a1 >= 10000 Then
a2 = iff(up4>=50000, up3, up4);
Else If a1 >= 5000 Then
a2 = iff(up5>=10000, up4, up5);
Else If a1 >= 1000 Then
a2 = iff(up5>=5000, up5, up6);
Else
a2 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
a2 = up6;
}
}
if date >= 19981207 then
{
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
dn1 = int(b1/100+0.00001)*100;
dn2 = int(b1/100+0.00001)*100;
dn3 = int(b1/100+0.00001)*100;
dn4 = int(b1/50+0.00001)*50;
dn5 = int(b1/10+0.00001)*10;
dn6 = int(b1/5+0.00001)*5;
dn7 = int(b1/1+0.00001)*1;
}
else {
dn1 = int(b1/1000+0.00001)*1000;
dn2 = int(b1/500+0.00001)*500;
dn3 = int(b1/100+0.00001)*100;
dn4 = int(b1/50+0.00001)*50;
dn5 = int(b1/10+0.00001)*10;
dn6 = int(b1/10+0.00001)*10;
dn7 = int(b1/1+0.00001)*1;
}
}
Else
{
dn1 = int(b1/1000+0.00001)*1000;
dn2 = int(b1/500+0.00001)*500;
dn3 = int(b1/100+0.00001)*100;
dn4 = int(b1/50+0.00001)*50;
dn5 = int(b1/10+0.00001)*10;
dn6 = int(b1/5+0.00001)*5;
dn7 = int(b1/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If b1 >= 500000 Then
b2 = dn1;
Else If b1 >= 100000 Then
b2 = iff(dn2>=500000, dn1, dn2);
Else If b1 >= 50000 Then
b2 = iff(dn3>=100000, dn2, dn3);
Else If b1 >= 10000 Then
b2 = iff(dn4>=50000, dn3, dn4);
Else If b1 >= 5000 Then
b2 = iff(dn5>=10000, dn4, dn5);
Else If b1 >= 1000 Then
b2 = iff(dn5>=5000, dn5, dn6);
Else
b2 = iff(dn6>=1000, dn6, dn6);
}
Else
{
If b1 >= 500000 Then
b2 = dn1;
Else If b1 >= 100000 Then
b2 = iff(dn2>=500000, dn1, dn2);
Else If b1 >= 50000 Then
b2 = iff(dn3>=100000, dn2, dn3);
Else If b1 >= 10000 Then
b2 = iff(dn4>=50000, dn3, dn4);
Else If b1 >= 5000 Then
b2 = iff(dn5>=10000, dn4, dn5);
Else If b1 >= 1000 Then
b2 = iff(dn5>=5000, dn5, dn6);
Else
b2 = iff(dn6>=1000, dn6, dn7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
b2 = dn6;
}
}
plot1(floor(a2));
plot2(Ceiling(b2));
2020-12-05
929
글번호 144458
답변완료
문의
1. 금일 첫봉부터 계산하는 수식으로 수정 요청
2. 수식 해석
3. cross 선언이 수식내에서 하는 역할
부탁드립니다.
*******************************************************************************
var : A1(0),A2(0),Acount(0);
var : B1(0),B2(0),Bcount(0);
A1 = L;
A2 = A1[1];
if A1 > A2 Then
Acount = Acount+1;
Else
Acount = 0;
var : cross(0);
if Bdate != Bdate[1] Then
cross = 0;
cross = cross+1;
if Acount == 3 Then
{
cross = cross+1;
if cross != 4 Then
Buy("b",AtMarket);
}
2020-12-05
775
글번호 144457
답변완료
문의 드립니다.
안녕하세요
항상 빠른 답변 감사드립니다.
1, 종목검색식
이전 30봉 부터 1봉전까지
볼린버밴드(30,2) 상단 > 볼린버밴드(10,2) 상단 상테 지속후
볼린버밴드(10,2) 상단이 볼린버밴드(30,2) 상단을 돌파
검색
2020-12-06
705
글번호 144456
답변완료
부탁드립니다.
안녕하세요.
종목검색식을 부탁드립니다.
0봉전 or 1봉전 or 2봉전 or 3봉전에
30이평과 240이평이 골든크로스가 난 종목검색식.
2020-12-05
777
글번호 144455