커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1603
글번호 230811
답변완료
수식부탁드립니다
수식부탁드립니다
1.아침 시초가보다 10%이상 돌파하면 매수 (수량=2주매수)
2. 아침 시초가보다 30% 돌파하면 일부청산 (1주 청산)
3. 아침 시초가보다 30% 돌파한적이 있다면 현재가가 아침 시초가 하향돌파시 전량청산
2022-12-09
995
글번호 164460
답변완료
피라미딩
피라미딩허용으로해놨습니다.
시뮬상으로 보면,
그림2에서 보면 , 10/7일은 잘 작동하는데,
그림1에서는 , 손절잘하는데 , 익절은 안합니다. 10/5일은 왜 손실로 잡히는지 이상합니다.
그렇다고, endtime에 걸려서 강제청산되는것도 아니고 , 오버물량으로 잡히는것도 아닙니다.
사진상으로 10/5일의 경우 매도3개후에 , 매수1개, 총 매도2개 잡고 있는걸로 이해하는게 맞는지요?
-----------------------------------------------------
아래와같이 간간한 테스트를 해봤는데,
같은 buy buy일 경우일때, 최근 진입시 이전포지션에 더해서 총 포지션 숫자로 표시되고,
buy sell 일 경우 , 각각의 진입 수량이 표시되는데,
뭔가 혼돈스럽고 , 실제 전략실행시 어떻게 작동될지 궁금합니다.
input : StartTime(90000),EndTime(151900);
var : 최소이익(1.6),손실범위(0.02);
var : 손절(1.92),익절(2.42); #44.97
#if stime >=90800 and stime <90900 Then {buy("Buy01",OnClose,Def,5);}
#if stime >=92700 and stime <92800 Then {Sell("Sell02",OnClose,Def,2);}
if stime >=90800 and stime <90900 Then {buy("Buy01",OnClose,Def,5);}
if stime >=92700 and stime <92800 Then {Buy("Buy02",OnClose,Def,2);}
input : PF0(2.42),PL0(1.92);
익절 = PF0;
손절 = PL0;
SetStopEndofday(EndTime);
SetStopProfittarget(익절,PointStop);
SetStoploss(손절,PointStop);
SetStopContract(); #생략가능
SetStopTrailing(손실범위 , 최소이익 , PointStop);
감사합니다.
2022-12-09
1207
글번호 164458
답변완료
양봉음봉도지점수
kospi200 선물
데이트레이딩
5분봉
당일 발생봉으로 계산
요청수식 1.
1 = 양봉 and 몸통 > 머리와꼬리의 합 and 몸통 > 0.2
2 = 양봉 and 몸통 < 머리와꼬리의 합 and 머리와 꼬리의 합 > 0.2
-1 = 음봉 and 몸통 > 머리와꼬리의 합 and 몸통 > 0.2
-2 = 음봉 and 몸통 < 머리와꼬리의 합 and 머리와 꼬리의 합 > 0.2
3 = 도지 and 꼬리 > 머리 and 꼬리 > 0.2
-3 = 도지 and 꼬리 < 머리 and 머리 > 0.2
0 = 나머지 모든 봉
if 12개봉의 합 > 5 then
buy();
if 12개봉의 합 < -5 then
sell();
요청수식 2
a = 양봉 and 몸통 > 머리와꼬리의 합 and 몸통 > 0.2
b = 양봉 and 몸통 < 머리와꼬리의 합 and 머리와 꼬리의 합 > 0.2
c = 음봉 and 몸통 > 머리와꼬리의 합 and 몸통 > 0.2
d = 음봉 and 몸통 < 머리와꼬리의 합 and 머리와 꼬리의 합 > 0.2
x = 도지 and 꼬리 > 머리 and 꼬리 > 0.2
y = 도지 and 꼬리 < 머리 and 머리 > 0.2
z = 나머지 모든 봉
if 12개봉에서 c c d x 배열 확인(z들은 무시) then
buy();
if 12개봉에서 a a b y 배열 확인(z들은 무시) then
sell();
위 수식 요청드립니다.
항상 감사합니다.
2023-04-24
1119
글번호 164457
답변완료
시스템 부탁 드립니다 ㅠ
일봉 차트 상에서, 주식 현물 로직을 한번 만들어보고 있는데,
청산식은 완성했는데 진입식에서 모르는게 많아서 도움을 구합니다 ㅠ
​
--------------------------------
​
현재까지 총 진입횟수 = n
ex) 첫 진입하면 n=1, 피라미딩 1회 하면 n=2, 피라미딩 2회하면 n=3
​
​
1.첫 진입: 종가 기준, x일 신고가 달성 시, 종가에 진입.
(첫 진입수량 : 현재 계좌 예수금 / 40 / 종가)
​
2.피라미딩: 현재가 기준, 직전 진입가격*( 1.1 + (n/100) ) 돌파 시
현재가에 바로실행
첫 진입 가격이 100만원 이라고 가정하면,
첫번째 피라미딩은 100*(1.1 + 0.01) = 100 * 1.11 = 111 돌파 시 시행
두번째 피라미딩은 111*(1.1 + 0.02) = 111 * 1.12 = 124 돌파 시 시행​
세번째 피라미딩은 124*(1.1 + 0.03) = 124 * 1.13 = 140 돌파 시 시행
이렇게 쭉 계속 진행
​
3. 피라미딩 수량 : ​
직전 진입 가격 * 직전 진입 수량 = 직전 진입 금액
이번 거래 시 진입 금액 = 직전 거래 진입 금액 * 0.95
이번 거래 시 진입 수량 = ( 직전 거래 진입 금액 * 0.95 ) / 현재가
​
------------------------------
부탁 좀 드리겠습니다 ㅠ
2022-12-09
876
글번호 164456
답변완료
문의 드립니다
input:length(5),a틱(20),b틱(20),c틱(5);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0);
Array:HH[10,2](0),LL[10,2](0);
input : StartTime(100000),EndTime(60000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
process = 0;
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If LL[1,1] > L Then process = -1;
If HH[1,1] < H Then process = 1;
}
Else If Highest(H,length) == H and lastHiVal <> H Then process = 1;
Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1;
If process == 1 Then
{
T = 1;
lastHiVal = H;
If HH[1,2] < LL[1,2] Then
{
For j = 10 DownTo 2
{
HH[j,1] = HH[j-1,1];
HH[j,2] = HH[j-1,2];
}
}
If HH[1,2] < LL[1,2] or HH[1,1] < H Then
{
HH[1,1] = H;
HH[1,2] = Index;
sBar = Index - LL[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if LL[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 1);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2));
Text_SetStyle(Text1, 2, 1);
}
Text_SetStyle(Text1, 2, 1);
}
if MarketPosition <= 0 and
HH[2,1] >= LL[2,1]+PriceScale*a틱 and
LL[1,1] <= HH[2,1]-PriceScale*b틱 and
Tcond == true Then
Buy("b",AtStop,HH[2,1]+PriceScale*c틱);
}
If process == -1 Then
{
T = -1;
lastLoVal = L;
If LL[1,2] < HH[1,2] Then
{
For j = 10 DownTo 2
{
LL[j,1] = LL[j-1,1];
LL[j,2] = LL[j-1,2];
}
}
If LL[1,2] < HH[1,2] or LL[1,1] > L Then
{
LL[1,1] = L;
LL[1,2] = Index;
sBar = Index - HH[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if HH[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
}
if MarketPosition >= 0 and
LL[2,1] <= HH[2,1]-PriceScale*a틱 and
HH[1,1] >= LL[2,1]+PriceScale*b틱 and
Tcond == true Then
Sell("s",AtStop,LL[2,1]-PriceScale*c틱);
}
if MarketPosition == 1 and IsEntryName("b") == true Then
Sell("bs",AtStop,EntryPrice-PriceScale*20);
if MarketPosition == -1 and IsEntryName("s") == true Then
Buy("sb",AtStop,EntryPrice+PriceScale*20);
해외선물에서 밤 12시 지나서 급격한 변동성에는 강제청산의 손절매신호가
작동하지 않아서 위 수식어에 익절과 손절의 수식어를 넣고자 하는데
아래 내용이 맞는지 문의 드립니다.
input:length(5),a틱(20),b틱(20),c틱(5);
input : 익절틱수(30),손절틱수(30);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0);
Array:HH[10,2](0),LL[10,2](0);
input : StartTime(100000),EndTime(60000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
process = 0;
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If LL[1,1] > L Then process = -1;
If HH[1,1] < H Then process = 1;
}
Else If Highest(H,length) == H and lastHiVal <> H Then process = 1;
Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1;
If process == 1 Then
{
T = 1;
lastHiVal = H;
If HH[1,2] < LL[1,2] Then
{
For j = 10 DownTo 2
{
HH[j,1] = HH[j-1,1];
HH[j,2] = HH[j-1,2];
}
}
If HH[1,2] < LL[1,2] or HH[1,1] < H Then
{
HH[1,1] = H;
HH[1,2] = Index;
sBar = Index - LL[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if LL[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 1);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2));
Text_SetStyle(Text1, 2, 1);
}
Text_SetStyle(Text1, 2, 1);
}
if MarketPosition <= 0 and
HH[2,1] >= LL[2,1]+PriceScale*a틱 and
LL[1,1] <= HH[2,1]-PriceScale*b틱 and
Tcond == true Then
Buy("b",AtStop,HH[2,1]+PriceScale*c틱);
}
If process == -1 Then
{
T = -1;
lastLoVal = L;
If LL[1,2] < HH[1,2] Then
{
For j = 10 DownTo 2
{
LL[j,1] = LL[j-1,1];
LL[j,2] = LL[j-1,2];
}
}
If LL[1,2] < HH[1,2] or LL[1,1] > L Then
{
LL[1,1] = L;
LL[1,2] = Index;
sBar = Index - HH[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if HH[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
}
if MarketPosition >= 0 and
LL[2,1] <= HH[2,1]-PriceScale*a틱 and
HH[1,1] >= LL[2,1]+PriceScale*b틱 and
Tcond == true Then
Sell("s",AtStop,LL[2,1]-PriceScale*c틱);
}
if MarketPosition == 1 and IsEntryName("b") == true Then
Sell("bs",AtStop,EntryPrice-PriceScale*20);
if MarketPosition == -1 and IsEntryName("s") == true Then
Buy("sb",AtStop,EntryPrice+PriceScale*20);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
----------------
input : n(1),손절틱수(200);
var : DD(0),Year(0),V1(0),V2(0),V3(0),V4(0),summer(False);
var : ST(0),ET(0),entry(0),Tcond(False);
var : cnt(0),hh(0),ll(0);
if NextBarSdate != sDate Then
{
DD = DayOfWeek(NextBarSdate);
Year = Floor(NextBarSdate/10000);
V1 = (10000 * Year) + (100 * 3) + 1;
V2 = 15 - dayofweek(v1);
v3 = (10000 * Year) + (100 * 11) + 1;
v4 = 8 - dayofweek(v3);
Summer = NextBarSdate > (10000 * Year) + (100 * 3) + v2
And NextBarSdate < (10000 * Year) + (100 * 11) + v4;
if summer == true Then
{
ST = 80000;
ET = 60000;
}
Else
{
ST = 80000;
ET = 60000;
}
}
if Year > 0 Then
{
hh = 0;
ll = 0;
For cnt = 0 to n-1
{
if hh == 0 or (hh > 0 and DayHigh(cnt) > hh) Then
hh = DayHigh(cnt);
if ll == 0 or (ll > 0 and DayLow(cnt) < ll) Then
ll = DayLow(cnt);
}
IF ET > ST Then
SetStopEndofday(ET);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(ET);
}
if ((sDate != sDate[1] and Stime >= ET) or
(sDate == sDate[1] and Stime >= ET and sTime < ET)) Then
Tcond = False;
if Bdate != Bdate[1] Then
{
Tcond = true;
entry = 0;
if ST <= ET Then
SetStopEndofday(0);
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if entry < 1 Then
Buy("b",AtLimit,hh-(hh-ll)*0.382);
ExitLong("bx",AtLimit,hh-(hh-ll)*0.050);
}
SetStopLoss(PriceScale*손절틱수,PointStop);
}
위는 N일 피보나치 수열에 당일진입및 청산의 수식어 입니다.
당일 장중 피보나치 수열에 고,저대비 아래의 0.382 % 매수후 위 0.959 % 청산되는
수식어로 변경하고자 합니다.
매매시간의 수식어가 국내선물인듯 밤 12시 이후로 신호가 나옵니다.
해이선물로 변경 바라고 매매시간은 아침8시부터 익일 7시까지입니다.
2022-12-09
812
글번호 164455
답변완료
기간 최고가 분봉표시
20일 기간 중 최고 종가를 분봉에 표시하려고 해요 도와주세요
2022-12-09
859
글번호 164454
답변완료
수정부탁드립니다
박스가 나타나지 안는것 수정 부탁 드립니다 Y 축 높이 동일하게 박스높이 조정가능하게 부탁드립니다
input: ATRLength3(90), ATRMult3(2.7),상승색a(Red),하락색a(Blue),색상두께(30);
vars: ATR3(0), avg3(0), dn3(0), up3(0), trend3(1), flag3(0), flagh3(0), qqq3(0),dbox(0);
ATR3 = ATR(ATRLength3) * ATRMult3;
avg3 = (High + Low)/2;
up3 = avg3 + ATR3;
dn3 = avg3 - ATR3;
if close > up3[1] then trend3 = 1;
else if close < dn3[1] then trend3 = -1;
if trend3 < 0 and trend3[1] > 0 then flag3 = 1; else flag3 = 0;
if trend3 > 0 and trend3[1] < 0 then flagh3 = 1; else flagh3 = 0;
if trend3 > 0 and dn3 < dn3[1] then dn3 = dn3[1];
if trend3 < 0 and up3 > up3[1] then up3 = up3[1];
if flag3 == 1 then up3 = avg3 + ATR3;
if flagh3 == 1 then dn3 = avg3 - ATR3;
if trend3 == 1 then qqq3 = dn3; else qqq3 = up3;
Plot3(qqq3,"qqq3",iff(trend3 == 1, Magenta, Blue));
if trend3 == 1 then qqq3 = up3;
dbox = box_new(sDate,sTime,H,NextBarSdate,NextBarStime,L);
Box_SetColor(dbox,상승색a);
Box_SetFill(dbox,true,색상두께);
Box_SetEnd(dbox,NextBarSdate,NextBarStime,L);
if trend3 == 1 then qqq3 = dn3;
dbox = box_new(sDate,sTime,H,NextBarSdate,NextBarStime,L);
Box_SetColor(dbox,하락색a);
Box_SetFill(dbox,true,색상두께);
Box_SetEnd(dbox,NextBarSdate,NextBarStime,L);
2022-12-08
744
글번호 164453
답변완료
macd기준선
macd이 기준선위에서 매수하고있다고 기준선이하일때 포지션정리
macd값이 기준선아래서 매도하고있다고 기준선이상일대 포지션정리
수식을 만들고 싶습니다
2022-12-08
910
글번호 164439
답변완료
부탁드립니다.
1. 캔들 윗꼬리가 몸통 길이보다 길면 매도하라, 캔들 아래 꼬리가 몸통 길이보다 길면 매수하라.
고맙습니다.
2022-12-08
921
글번호 164438