커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
6116
글번호 230811
답변완료
문의드립니다.
수식은 "전일거래량 대비 상승표시"입니다.
1. 20일전까지의 거래량합계 대비 상승표시로 변환부탁드려요.
2. 20일전 거래량 대비 상승표시로 변환부탁드려요.
.....................................................
input : 기준1(70),기준2(200);
var : A1(0),A2(0),A3(0);
A1 = Accum(V);
if sdate != sdate[1] Then
{
A2 = A1[1];
var1 = (A1[1]-A2[1])*(기준1/100);
var2 = (A1[1]-A2[1])*(기준2/100);
}
A3 = A1-A2;
if A3 >= var1 Then
PlotPaintBar(H,L,"강조",MAGENTA);
if A3 >= var2 Then
PlotPaintBar(H,L,"강조",CYAN);
2018-10-29
192
글번호 123131
답변완료
문의
1. 외국인 누적지표에서 전고점 전저점을 표시부탁드립니다
2018-10-29
183
글번호 123130
답변완료
문의드립니다.
항상 친절하신 답변 고맙습니다.
주봉으로 매매를 하려고 하는데 토요일에 매매신호가 발생합니다. 어떻게 해야 하나요..
아래식을 적용해도 2017.12.30(토)에 매수신호가 발생해서 도움을 요청합니다.
if MAv > MAv[1] and (DayOfWeek(sdate) >= 1 and DayOfWeek(sdate) <= 5) Then {
Buy();
}
Else If MAv < MAv[1] and (DayOfWeek(sdate) >= 1 and DayOfWeek(sdate) <= 5) Then {
Sell();
}
수고하세요
2018-10-29
188
글번호 123129
답변완료
수식 부탁드립니다.
매번 수식작성에 많은 도움을 주셔서 감사드립니다.
여쭙고자 하는 내용은
실전매매가 아닌 매매의 결과치라도 알고 싶어서 문의 드립니다.
<조건>
현금: 100만원.
사용챠트는 1분봉 입니다.
매수조건 완성시 시장가로 100% 매수후
1번 매도조건: 당일 종가때 40% 매도하고
다음날 시가때 나머지 매도 입니다.
당일 종가 100% 매도의 경우는
if NextBarSdate != sdate Then
exitlong("bx",OnClose);
이렇게 만든 수식으로 결과치를 볼 수가 있었는데,(제대로 만든건지 잘 모르겠네요^^)
매수량의 40%를 매도하고 다음날 시가매도 할려니 모르겠더라구요.
1번 매도조건이 아닌 다른 매도조건인 경우도 여쭙고 싶은데요
2번 매도조건: 당일 종가때 40% 매도하고
나머지 수량은 일봉차트상 주가가 5일 이평선보다 높으면 계속 보유하고
5일 이평선보다 낮아질 경우 전량매도 하는 겁니다.
종가매도는 실전매매에서 구현이 안된다고 얘기를 들었기때문에
단지 시뮬레이션 결과치만이라도 알고 싶습니다. 부탁드립니다.
2018-10-28
176
글번호 123128
답변완료
문의
Input:af(0.02),maxAF(0.2);
Var:TL1(0),TL2(0),TL2_exist(0),color(0),
TL_NewBit(0), // 1:NewLine 2:SetEndLine
slope(0),mid_idx(0),mid_val(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
Value1 = SarZigZag(af,maxAF,고,저,TL_NewBit);
If Value1 == 1 Then { // 고점
If TL_NewBit == 1 Then { // 신규
If 고[2,1] < 고[1,1] Then {
slope = (고[1,1] - 저[1,1]) / (고[1,2] - 저[1,2]);
mid_idx = Floor((고[2,1] - 저[1,1]) / slope);
mid_val = slope * mid_idx + 저[1,1];
Var1 = Index - (저[1,2] + mid_idx);
TL1 = TL_New(저[1,3],저[1,4],저[1,1],sDate[Var1],sTime[Var1],mid_val);
TL2 = TL_New(sDate[Var1],sTime[Var1],mid_val,고[1,3],고[1,4],고[1,1]);
Var2 = Index - 저[1,2];
TL_SetColor(TL1,color[Var2]);
color = RED;
TL_SetColor(TL2,color);
TL2_exist = 1;
} Else {
TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetColor(TL1,color);
TL2_exist = 0;
}
}
If TL_NewBit == 2 Then { // 연장
TL_Delete(TL1);
If TL2_exist == 1 Then TL_Delete(TL2);
If 고[2,1] < 고[1,1] Then {
slope = (고[1,1] - 저[1,1]) / (고[1,2] - 저[1,2]);
mid_idx = Floor((고[2,1] - 저[1,1]) / slope);
mid_val = slope * mid_idx + 저[1,1];
Var1 = Index - (저[1,2] + mid_idx);
TL1 = TL_New(저[1,3],저[1,4],저[1,1],sDate[Var1],sTime[Var1],mid_val);
TL2 = TL_New(sDate[Var1],sTime[Var1],mid_val,고[1,3],고[1,4],고[1,1]);
Var2 = Index - 저[1,2];
TL_SetColor(TL1,color[Var2]);
color = RED;
TL_SetColor(TL2,color);
TL2_exist = 1;
} Else {
TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetColor(TL1,color);
TL2_exist = 0;
}
}
} Else If Value1 == -1 Then { // 저점
If TL_NewBit == 1 Then { // 신규
If 저[2,1] > 저[1,1] Then {
slope = (저[1,1] - 고[1,1]) / (저[1,2] - 고[1,2]);
mid_idx = Floor((저[2,1] - 고[1,1]) / slope);
mid_val = slope * mid_idx + 고[1,1];
Var1 = Index - (고[1,2] + mid_idx);
TL1 = TL_New(고[1,3],고[1,4],고[1,1],sDate[Var1],sTime[Var1],mid_val);
TL2 = TL_New(sDate[Var1],sTime[Var1],mid_val,저[1,3],저[1,4],저[1,1]);
Var2 = Index - 고[1,2];
TL_SetColor(TL1,color[Var2]);
color = BLUE;
TL_SetColor(TL2,color);
TL2_exist = 1;
} Else {
TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetColor(TL1,color);
TL2_exist = 0;
}
}
If TL_NewBit == 2 Then { // 연장
TL_Delete(TL1);
If TL2_exist == 1 Then TL_Delete(TL2);
If 저[2,1] > 저[1,1] Then {
slope = (저[1,1] - 고[1,1]) / (저[1,2] - 고[1,2]);
mid_idx = Floor((저[2,1] - 고[1,1]) / slope);
mid_val = slope * mid_idx + 고[1,1];
Var1 = Index - (고[1,2] + mid_idx);
TL1 = TL_New(고[1,3],고[1,4],고[1,1],sDate[Var1],sTime[Var1],mid_val);
TL2 = TL_New(sDate[Var1],sTime[Var1],mid_val,저[1,3],저[1,4],저[1,1]);
Var2 = Index - 고[1,2];
TL_SetColor(TL1,color[Var2]);
color = BLUE;
TL_SetColor(TL2,color);
TL2_exist = 1;
} Else {
TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetColor(TL1,color);
TL2_exist = 0;
}
}
}
TL_SetSize(TL1,2);
TL_SetSize(TL2,2);
데이타2에 적용할려면 어떻게 바꿔야 하나요,부탁드립니다
2018-10-28
210
글번호 123127
답변완료
문의드립니다.
안녕하세요.
문의드맇 사항은 각각의 시스템은 정상적으로 되나 2가지 시스템을 합성할 경우 문제가 발생합니다. 검토 부탁드립니다.
문제점 1 : 이익 청산 시 2개 물량이 먼저 동시 청산됩니다.
문제점 2 :
System I:
input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (15);
Input : 전환선기간 (5), 기준선기간1(26), 기준선기간2(1), 선행스팬2기간(52), short(12), long(26), sig(9),BBP(120), 당일누적손실틱수 (100);
Var : MACDv(0), MACDsig(0),macdosc(0), Condition3(false);
var : 전환선 (0), 기준선1(0), 기준선2(0), 후행스팬(0), 선행스팬1(0), 선행스팬2(0), Xcond(false),N1(0),daypl(0),당일누적손실 (0);
var1 = MACD(short, long);
var2 = ema(MACDv,sig);
var3 = ma(C,BBP);
전환선 = (Highest(High, 전환선기간 ) + Lowest(Low, 전환선기간 )) / 2;
기준선1 = (Highest(High, 기준선기간1 ) + Lowest(Low, 기준선기간1 )) / 2;
기준선2 = (Highest(High, 기준선기간2 ) + Lowest(Low, 기준선기간2 )) / 2;
선행스팬1 = (전환선 [25] + 기준선2 [25]) / 2 ;
선행스팬2 = (Highest(High, 선행스팬2기간 )[25] + Lowest(Low, 선행스팬2기간 )[25]) / 2;
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
if 거래시간 == 1 or 거래시간 == 2 then
{
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
{
Xcond = false;
N1 = NetProfit;
}
}
else
{
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
}
당일누적손실 = PriceScale*당일누적손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
# 매수/매도청산
if MarketPosition == 0 and
TotalTrades == TotalTrades[3] and
Xcond == false and
Condition3 == true and var3 > var3[1] and var1 > var2 and 전환선 > 기준선1 and crossup(C,전환선 ) and C > O Then
{
Buy("b",OnClose,def,3);
ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1);
ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1);
ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3);
}
# 매도/매수청산
if MarketPosition == 0 and TotalTrades == TotalTrades[3] and
Xcond == false and
Condition3 == true and var3 < var3[1] and var1 < var2 and 전환선 < 기준선1 and CrossDown(C,전환선 ) and C < O Then
{
Sell("s",OnClose,def,3);
ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1);
ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1);
ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3);
}
if MarketPosition == 1 Then{
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then
ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then
ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then
ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3);
}
if MarketPosition == -1 Then{
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then
ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1);
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then
ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1);
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then
ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if MarketPosition == 1 then
{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts));
}
System 2:
input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (10);
Input : shortPeriod(12), longPeriod(26), 당일누적손실틱수 (100);
Var : value(0), Condition3(false);
var : Xcond(false),N1(0),daypl(0),당일누적손실 (0);
value = MACD(shortPeriod, longPeriod);
if 거래시간 == 1 then
condition3 = (stime>=시작시간 or stime<=끝시간);
Else if 거래시간 == 2 then
condition3 = (stime>=시작시간 and stime<=끝시간);
Else
condition3 = true;
if 거래시간 == 1 or 거래시간 == 2 then
{
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then
{
Xcond = false;
N1 = NetProfit;
}
}
else
{
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
}
당일누적손실 = PriceScale*당일누적손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
# 매수/매도청산
if MarketPosition == 0 and
TotalTrades == TotalTrades[3] and
Xcond == false and
Condition3 == true and CrossUP(value, 0) Then
{
Buy("b",OnClose,def,3);
ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1);
ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1);
ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3);
}
# 매도/매수청산
if MarketPosition == 0 and TotalTrades == TotalTrades[3] and
Xcond == false and
Condition3 == true and CrossDown(value, 0) Then
{
Sell("s",OnClose,def,3);
ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1);
ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1);
ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3);
}
if MarketPosition == 1 Then{
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then
ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then
ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1);
if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then
ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3);
}
if MarketPosition == -1 Then{
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then
ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1);
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then
ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1);
if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then
ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if MarketPosition == 1 then
{
ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts));
}
2018-10-28
267
글번호 123126
qha71 님에 의해서 삭제되었습니다.
2018-10-28
10
글번호 123125
답변완료
문의
안녕하세요.
1번 문의
무포지션 일때 항상 변수초기화 하고요.
무포지션에서
현재봉이 양봉이고 전봉도 양봉,전전봉도 양봉이면
즉 현재봉 포함 3연속으로 양봉이 연속할 때 매수하고요.
매수후 음봉이 연속이던지 아니던지 음봉의 총갯수가 2개가 발생하면
매수청산합니다.
무포지션에서
현재봉이 음봉이고 전봉도 음봉,전전봉도 음봉이면
즉 현재봉 포함 3연속으로 음봉이 연속할 때 매도하고요.
매도후 양봉이 연속이던지 아니던지 양봉의 총갯수가 2개가 발생하면
매도청산합니다.
2번 문의
무포지션에서 항상 초기화 하고요.
무포지션에서
현재봉이 양봉이고 현재봉 포함해서 과거 4봉중에 양봉이 3개이상일 때 매수합니다.
매수후 음봉이 연속이던지 아니던지 음봉의 총갯수가 2개가 발생하면
매수청산합니다
무포지션에서
현재봉이 음봉이고 현재봉 포함해서 과거 4봉중에 음봉이 3개이상일 때 매도합니다.
매도후 양봉이 연속이던지 아니던지 양봉의 총갯수가 2개가 발생하면
매도청산합니다
2018-10-28
170
글번호 123124
세발낚지 님에 의해서 삭제되었습니다.
2018-10-28
0
글번호 123123