커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
8212
글번호 230811
답변완료
부탁드립니다,,,
if (PreBuyPrice == 0 or (PreBuyPrice > 0 and c > PreBuyPrice)) Then{
if max(var3,var4, var5) < min(var3, var4, var5)* (1+5/100) && c>(hh+ll)/2 && c<value3+1 &&
C > var6[1] && C[1] <= var6[2] && CrossUp(c,(r2+c)/2) && c<r2+0.2 && sma2>value1 && c>(r2+s2)/2 && c<(r2+s2)/2+10 && c>(preHval+preLval)/2+0.1 && c>(preHval+preLval)/2-0.1 && c>(preHval+((preHval+preLval)/2+0.1))/2 && c>(preLval+((preHval+preLval)/2-0.1))/2 Then
buy("매수2");
}
if (PreBuyPrice == 0 or (PreBuyPrice > 0 and c < PreBuyPrice)) Then{
if max(var3,var4, var5) < min(var3, var4, var5) * (1+5/100) && c<(hh+ll)/2 && c>value3-1 &&
C < var7[1] && C[1] >= var7[2] && CrossDown(c,(s2+c)/2) && c>s2-0.2 && sma2<value2 && c<(r2+s2)/2 && c>(r2+s2)/2-10 && c<(preHval+preLval)/2+0.1 && c<(preHval+preLval)/2-0.1 && c<(preHval+((preHval+preLval)/2+0.1))/2 && c<(preLval+((preHval+preLval)/2-0.1))/2 Then
sell("매도2");
}
위의 수식은 제가 사용하는 매수매도 수식 일부입니다..
본수식은 틱으로 설정하여 사용하고 있습니다,,,
여기에 매수매도 조건에,,
우리투자증권에서 제공하는 참조데이터를 참조하여,,,
외국인이 개인보다 선물매수이고,외국인이 개인보다 풋매도이면 매수진입,,,,,,
외국인이 개인보다 선물매도이고,외국인이 개인보다 콜매도이면 매도진입,,,,,,
금액으로 입니다.
위의 두조건을 각각 신호수식에 조건으로 첨부하고 싶은데 어떻게 해야되는지요,,,
그리고 현재 틱차트를 사용하고 있는데 위의 조건들을 넣으려면 어떻게 해야하는지요,,,
부탁드립니다.....
2013-09-09
215
글번호 67335
답변완료
미국지수 참조하여 거래
혼자서 시스템트레이딩을 공부하고 있는데
생각을 전략으로 만들고 다시 프로그램화하는데 상당히 어렵습니다.
그래서 도움을 요청합니다.
미리 노고에 감사드립니다.
전일 미 s&p500지수를 참조하여 전략을 만들고자 합니다.
차트는 4분데이타를 사용 하였으며...
data2 ; 외국인 순매수금액
data3 ; 프로그램 비차익 순매수금액
data4 ; s&p500 일간
전일 s&p500 지수가 1% 이상 상승 및 하락을 하였고
and 당일 9시 22분 기준으로 외국인 매수금액이 200억이상이고
and 당일 9시 22분 기준으로 프로그램 비차익이 10억이상 매수이면
선물 1계약 매수
전일 s&p500 지수가 1% 이상 상승 및 하락을 하였고
and 당일 9시 22분 기준으로 외국인 매도금액이 200억이상이고
and 당일 9시 22분 기준으로 프로그램 비차익이 10억이상 매도이면
선물 1계약 매도
포지션 정리 14:50분 기준
외국인 매수 또는 매도 금액이 2000억 이상이고
프로그램 비차익 매수 또는 매도 금액이 500억 이상이면 오버나잇
선물 매수 오버시
외국인 매수가 일간기준 매수이면 계속 오버하여 외국인이 일간기준 매도 첫날 11시에 매도
선물 매도는 그반대...
감사합니다. 수고하세요
2013-09-09
208
글번호 67330
답변완료
문의드립니다.
안녕하세요.
청산 exitlong을 쓸 때, 보유수량이 있을 경우에만 주문이 들어갈 수 있게 할 수 있나요?
예를 들면, 매수 신호에서 매수가 실패하여 보유 수량이 없을 경우에는 exitlong 주문이 실행되지 않게끔 하는 것입니다.
그리고, 매수는 한 번이지만, 청산은 3번에 나누어서 할 경우 각각의 청산 주문시에도 수량이 없을 경우에는 주문이 들어가지 않는 식을 어떻게 추가하면 되는지 알려주셨으면 합니다.
그리고, 아래 시스템식에서 count < 2 로 매수 주문 횟수 제한을 걸었는데, 주문이 여러번 들어갑니다. 어떤 오류인지 모르겠습니다.
input : MM(200),N(100),XN1(100),XN2(200);
var : LH(0), count(0);
#당일 저점이 후의 최고가
if L == daylow Then{
LH = H;
var1 = stime;
}
if stime > var1 and H > LH Then
LH = H;
#저점이후의 가격이 저점대비 200%이상상승했을 경우
#저점대비 100% 상승한 가격에서 매수
if 091000 < stime and stime < 150000 and
stime > var1 and count < 2 and
LH >= DayLow*(1+MM/100) Then
buy("B", AtLimit, DayLow*(1+N/100));
if MarketPosition == 1 Then{
#진입이후 첫청산
if CurrentContracts == MaxContracts Then
ExitLong("bx1",AtLimit,EntryPrice*(1+XN1/100),"",int(MaxContracts*0.8),1);
#진입이후 두번째 청산
if CurrentContracts < MaxContracts Then
ExitLong("bx2",AtLimit,EntryPrice*(1+XN2/100),"",int(MaxContracts*0.2),1);
#매수후 10개봉 이후에 직전30개봉의 최저가 대비 -1틱 붕괴시 청산
if MarketPosition == 1 and BarsSinceEntry >= 10 Then
exitlong("bx",AtStop,lowest(L,30)-PriceScale*2);
}
SetStopEndofday(144500);
감사합니다.
2013-09-09
210
글번호 67328
답변완료
감사합니다.
우선 감사드립니다.
이익 실현 및 손절매 후 일정기간 동안(예들 들면 손절매 후 15동안은 매수신호 발생하더라도 매수금지)은 자동매수주문을 금지하는 수식은 어떻게 되는지 궁금합니다.
감사합니다.
2013-09-09
179
글번호 67327
답변완료
식문의 드립니다
노고 많으십니다.
1. 매수: Positive Volume index (52)의 signal선이 기준선을 상향시 매수
2. 매도: Positive Volume index (52)의 signal선이 기준선을 하향시 매도
3. 매수: Positive Volume index (52)의 signal선이 0선을 상향시 매수
4. 매도: Positive Volume index (52)의 signal선이 0선을 하향시 매도
감사 드립니다.
2013-09-08
195
글번호 67326
답변완료
수정 부탁 드립니다
수고 많으십니다
바로 밑에 식은 매수식이구요 매수식은 정상으로 돌아 가는거 같은데
매수식 아래레 매도식을 넣어 놨습니다 매도식은
y,x,q,w가 있는 맨 아래쪽 수식들이 반영이 되질 않는거 같습니다
보시고 한번 수정 부탁 드립니다
그리고 매수 매도 둘다 수식에 보시면 최초 매수쪽과 최초 매도 쪽
그리고 끝쪽에 보시면 z와 n값이 and로 묶여져 있습니다 둘중 하나만 만족해도
되도록 하고 싶습니다
특히 이쪽 부분
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
(q or w) and (n or z) 이렇게 되야 하거든요 요것도 같이 좀 부탁 드립니다
input : StartTime(90200);
input : RSVValue(60);
input : LossPoint(0.65),재매수횟수(10),재매수청산횟수(10),ProfitPoint(10);
input : 청산양봉갯수(20),청산음봉갯수(3);
input : z(1.35);
input : N(1.75);
input : y(3.7);
input : x(3.7);
input : q(3.7);
input : w(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(30),RSIvalue2(50);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(7);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(22);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(29);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(60);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(56);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(3);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav5,BarsSinceExit(1)) >= 1)) and
C <= DayLow+N and
MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& RSV > RSVValue
&& C > MAv5
&& C < dayopen+z
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv5 Then
Exitlong("매수청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv6 and
countif(C < mav5,BarsSinceExit(1)) < 1 Then
buy("재매수");
}*/
if MarketPosition == 1 and ReEL < 재매수청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV < RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C <= DayLow+N and
C < dayopen+z Then
ExitLong("매수청산4");
}
if MarketPosition == 0 and IsExitName("매수청산4",1) == true and count > 0 and RSIV > RSIvalue2 and
rebuy < 재매수횟수 and C > MAv6 and C > MAv5 and close > open and countif(C < mav5,BarsSinceExit(1)) < 1 and C <= DayLow+N and
C < dayopen+z then
buy("재매수");
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
input : StartTime(90200);
input : RSVValue(32);
input : LossPoint(0.6),재매도횟수(10),재매도청산횟수(10),ProfitPoint(2.5);
input : 청산양봉갯수(3),청산음봉갯수(20);
input : z(1.35);
input : N(-1.7);
input : y(3.7);
input : X(0.5);
input : q(3.7);
input : w(-3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(60),RSIvalue2(42);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(10);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(12);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(15);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(18);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(47);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(6);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav5,BarsSinceExit(1)) >= 1)) and
C >= dayhigh+N and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
RSV < RSVValue and
C < MAv5 and
C > dayopen-z
Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv5 Then
ExitShort("매도청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond2 == true,진입음봉갯수) == 진입음봉갯수 ) and
reSell < 재매도횟수 and C < MAv6 and
countif(C > mav5,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}*/
if MarketPosition == -1 and ReES < 재매도청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV > RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C >= dayhigh+N and C > dayopen-z Then
Exitshort("매도청산4");
}
if MarketPosition == 0 and IsExitName("매도청산4",1) == true and count > 0 and RSIV < RSIvalue2 and
reSell < 재매도횟수 and C < MAv6 and C < MAv5 and close < open and countif(C > mav5,BarsSinceExit(1)) < 1
and C >= dayhigh+N and C > dayopen-z then
sell("재매도");
if MarketPosition == -1 and C >= dayhigh+q and C > dayopen-w and C <= dayhigh+N and C < dayopen-z Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
2013-09-09
218
글번호 67325
수다리 님에 의해서 삭제되었습니다.
2013-09-11
26
글번호 67324
답변완료
한가지만 바꿔 주십시요.
청산, 한가지 바꿔 주세요...
*오늘 매수되었고, 14:40시에 매수가 대비 5% 이상 상승했다면 다음 첫봉에 청산.을
*오늘 매수되었고, 매수가 대비 주가가 6% 상승시 다음 첫봉에 청산. 으로 바꿔 주십시요.
감사합니다.
=================================================
input : P(5);
var : cnt(0),sum(0),sum1(0),mav(0),mav1(0),dis(0),dis1(0),daycnt(0);
if date != date[1] Then
Daycnt = daycnt+1;
sum = 0;
sum1 = 0;
for cnt = 0 to P-1{
sum = sum+DayClose(cnt);
sum1 = sum1+DayClose(cnt+1);
}
mav = sum/P;
mav1 = sum1/P;
dis = c/mav*100;
dis1 = DayClose(1)/mav1*100;
if date != date[1] Then
var1 = O/mav*100;
if ExitDate(1) != sdate and
MarketPosition == 0 and
var1 > 100 and
dayhigh <= DayClose(1)*1.10 and
dayopen <= DayClose(1)*1.06 and
dis1 >= 104 then{
if daylow <= DayClose(1)*0.99 and
daylow > DayClose(1)*0.96 and
dis >= 100 and dis <= 102.5 Then
buy("매수1");
if daylow <= DayClose(1)*0.96 and
daylow > DayClose(1)*0.93 and
dis >= 100 and dis <= 102.75 Then
buy("매수2");
if daylow <= DayClose(1)*0.93 and
daylow > DayClose(1)*0.90 and
dis >= 100 and dis <= 103 Then
buy("매수3");
if daylow <= DayClose(1)*0.90 and
daylow > DayClose(1)*0.87 and
dis >= 100 and dis <= 103.25 Then
buy("매수4");
if daylow <= DayClose(1)*0.87 and
dis >= 100 and dis <= 103.5 Then
buy("매수5");
}
if MarketPosition == 1 Then{
exitlong("Profit",Atlimit,EntryPrice*1.135);
exitlong("bx1",AtStop,EntryPrice*0.865,"매수1");
exitlong("bx2",AtStop,EntryPrice*0.87,"매수2");
exitlong("bx3",AtStop,EntryPrice*0.875,"매수3");
exitlong("bx4",AtStop,EntryPrice*0.88,"매수4");
exitlong("bx5",AtStop,EntryPrice*0.885,"매수5");
if daycnt >= daycnt[BarsSinceEntry]+3 and (stime == 140000 or (stime > 141000 and stime[1] < 141000)) Then
ExitLong("x");
}
2013-09-08
221
글번호 67323
답변완료
함수문의
안녕하세요 팝업 경고창에문의합니다
경고창의크기조절하고 상하좌우 위치 바탕색조정등의 수식을부탁합니다
2013-09-08
191
글번호 67322