커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1642
글번호 230811
답변완료
문의드립니다.
좋은 답변 감사드립니다.
지수 변동이 생길 때 첫 진입 방법은 그대로 하고, 다음 추가 진입 방법을 변경해주시면 고맙겠습니다.
2, 3, 4, 5, 6, 7...번째까지 추가 진입시 첫 진입 이후 추가되는 +, - 진입 틱 수를 각각 지정할 수 있게 해주시고,
2, 3, 4, 5, 6, 7...번째까지 추가 진입 수량도 각각 지정할 수 있게 해주세요.
라고 위와 같이 문의드려 아래와 같은 답을 받았으나, 추가진입 수량이 각 단계별로 1,2,3,4,5,6개가 추가되어 총 진입수량이 1,3,6,10,15,21개로 고정되어 나타납니다.
각 단계마다 제가 원하는 수량 만큼 추가 진입될 수 있게 수정 부탁드립니다.
안녕하세요
예스스탁입니다.
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0);
var:T(0),B(0),Bx(0),S(0),Sx(0);
Array:고점[10,2](0),저점[10,2](0);
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
T = 1;
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then{
color = RED;
# buy("b");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
}
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
lastLoVal = L;
If 저점[1,2] < 고점[1,2] Then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{
color = blue;
# sell("s");
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
}
}
}
TL_SetSize(TL1,3);
input : 첫진입틱수(1);
input : N1(1),추가진입틱수1(5);
input : N2(1),추가진입틱수2(10);
input : N3(1),추가진입틱수3(15);
input : N4(1),추가진입틱수4(20);
input : N5(1),추가진입틱수5(25);
input : N6(1),추가진입틱수6(30);
#상승구간의 마지막저점 저장
if Color == RED Then
{
var1 = 저점[2,1];
}
#하락구간의 마지막 고점 저장
if Color == BLUE Then
{
var2 = 고점[2,1];
}
if MarketPosition <= 0 Then
{
if color == BLUE and var1 > 0 and L > var1-PriceScale*첫진입틱수 Then
Buy("b1",AtLimit,var1-PriceScale*첫진입틱수,1);
}
if MarketPosition == 1 Then
{
value1 = Floor(MaxEntries/N1)+1;
value2 = Floor(MaxEntries/N2)+1;
value3 = Floor(MaxEntries/N3)+1;
value4 = Floor(MaxEntries/N4)+1;
value5 = Floor(MaxEntries/N5)+1;
value6 = Floor(MaxEntries/N6)+1;
if MaxEntries == 1 Then
Buy("b2",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수1),value1);
if MaxEntries == 2 Then
Buy("b3",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수2),value2);
if MaxEntries == 3 Then
Buy("b4",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수3),value3);
if MaxEntries == 4 Then
Buy("b5",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수4),value4);
if MaxEntries ==5 Then
Buy("b6",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수5),value5);
if MaxEntries == 6 Then
Buy("b7",AtLimit,(var1[BarsSinceEntry]-PriceScale*첫진입틱수)-(PriceScale*추가진입틱수6),value6);
if T == -1 and 고점[1,1] > 0 Then
ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1);
if T == 1 and 고점[2,1] > 0 Then
ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1);
}
if MarketPosition >= 0 Then
{
if Color == RED and Var2 > 0 and H < var2+PriceScale*첫진입틱수 Then
Sell("s1",AtLimit,Var2+PriceScale*첫진입틱수,1);
}
if MarketPosition == -1 Then
{
value1 = Floor(MaxEntries/N1)+1;
value2 = Floor(MaxEntries/N1)+1;
value3 = Floor(MaxEntries/N1)+1;
value4 = Floor(MaxEntries/N1)+1;
value5 = Floor(MaxEntries/N1)+1;
value6 = Floor(MaxEntries/N1)+1;
if MaxEntries == 1 Then
Sell("s2",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수1),value1);
if MaxEntries == 2 Then
Sell("s3",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수2),value2);
if MaxEntries == 3 Then
Sell("s4",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수3),value3);
if MaxEntries == 4 Then
Sell("s5",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수4),value4);
if MaxEntries == 5 Then
Sell("s6",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수5),value5);
if MaxEntries == 6 Then
Sell("s7",AtLimit,(var2[BarsSinceEntry]+PriceScale*첫진입틱수)+(PriceScale*추가진입틱수6),value6);
if T == 1 and 저점[1,1] > 0 Then
ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1);
if T == -1 and 저점[2,1] > 0 Then
ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1);
}
2022-10-05
1017
글번호 162726
답변완료
시스템
안녕하세요
아래식 해석 부탁드립니다
Input : Period(14), LPercent(40), SPercent(60);
Var : value(0);
value1 = RSI(Period);
Input : Period(20);
Var : value(0);
value2 = VR(Period);
If CrossUP(value1,LPercent ) Then
value = 1;
If CrossUp(value2,100) Then
value = value1 + 1;
if value >= 2 then buy();
수고하세요
2022-10-05
964
글번호 162725
답변완료
문의드립니다.
검색식 문의드립니다.
1번:
10분 봉에서 당일 첫봉의 고가 보다 두번째 봉의 종가는 낮고,
이후 50봉이내 첫봉의 고가를 종가가 돌파하는 종목 검색
(돌파봉의 거래량은 첫봉의 거래량80%~300%이내)
2번: 10분봉에서 당일 첫봉부터 10번째 봉까지의 고가를
20봉이내 종가가 돌파는 종목 검색
(돌파봉의 거래량은 고가봉의 거래량80%~300%이내)
2022-10-04
1071
글번호 162724
답변완료
감사 합니다
input : midPeriod(26),period(20),d1(2);
var : bb(0);
bb = BollBandUp(Period,d1);
if CrossUp(c,bb[midperiod-1]) Then
Plot1(L,"검색");
#####정말 감사합니다
크기 색깔 크게부탁드립니다
혹시 색깔 조정 가능한지요
2022-10-04
990
글번호 162723
답변완료
감사합니다
nput : Period(10),multiple(3),MA_period(125);
var : base(0),ATRv(0),lower_band(0),upper_band(0),uptrend(0),downtrend(0);
base=(H+L)/2;
ATRv = ATR(Period);
lower_band=base-ATRv*multiple;
upper_band=base+atr(period)*multiple;
if highest(lower_band, period)[1] < lower_band Then
uptrend = lower_band;
if lowest(upper_band, period)[1] > upper_band Then
downtrend = upper_band;
var1 = Ema(c,ma_Period);
if var1 < C and C > uptrend Then
PlotPaintBar(H,L,"강조",Magenta);
if var1 > C and C < downtrend Then
PlotPaintBar(H,L,"강조",Cyan);
######첨부파일사진처럼 차트위에 부탁드립니다
2022-10-04
916
글번호 162722
답변완료
수정부탁드립니다
현재 ema 기준 인경우 수직선표시 ema 설정시점 이탈시 기존수직 표시선 삭제 부탁드립니다.
Input:af(0.02),maxAF(0.25),ssk(60);
Var:오늘(0),극대(0),극저(0),가속(0),내일(0),hd(0),hkl(1),hdl(-1),tl(0);
Var1 = Ema(C,ssk);
if Var1 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = Var1; 극저 = Var1;
}
if Var1 > 0 and
오늘[1] == 0 then {
if hd[1] == 0 then {
if Var1[1] < Var1 then hd = hkl;
if Var1[1] > Var1 then hd = hdl;
}
if hd[1] == hkl and Var1[1] > Var1 then {
hd = hdl;
오늘 = 극대[1];
가속 = af;
}
if hd[1] == hdl and Var1[1] < Var1 then {
hd = hkl;
오늘 = 극저[1];
가속 = af;
}
극저 = min(Var1,극저);
극대 = max(Var1,극대);
}
//Text_New(sdate,stime,극대,"↑");
//Text_New(sdate,stime,극저,"↓");
if 오늘[1] > 0 then {
if hd[1] == hkl then {
if Var1 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if Var1 > 극대[1] then {
극대 = Var1;
가속 = min(maxAF,가속+af);
}
}
else {
hd = hdl;
오늘 = 극대[1];
극대 = 0;
극저 = Var1;
가속 = af;
}
}
if hd[1] == hdl then {
if Var1 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if Var1 < 극저[1] then {
극저 = Var1;
가속 = min(maxAF,가속+af);
}
}
else {
hd = hkl;
오늘 = 극저[1];
극저 = 0;
극대 = Var1;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
if var1 > C Then
{
Plot1(var1, "오늘",BLUE);
tl = TL_New(sdate,stime,9999999,sdate,stime,0);
TL_SetColor(tl,Blue);
}
Else
{
Plot1(var1, "오늘",RED);
tl = TL_New(sdate,stime,9999999,sdate,stime,0);
TL_SetColor(tl,Red);
}
2022-10-04
975
글번호 162721
답변완료
거래량 거래대금 수식 문의드립니다.
안녕하세요... 답변 주셔서 감사합니다.
그런데 제가 원하는 지표는 거래량 막대그래프에 마우스를 올렸을 때
첨부파일을 올린 키움의 영웅문처럼 한번에 모든 수치를 볼 수 있는
수식을 알고 싶습니다.
1~4번까지 수식을 하나의 거래량 지표에 구현하는 방법을 알고 싶습니다.
감사합니다.
주신 수식을 랭귀지편집기에 모두 복사해서 넣으면 아래 첨부파일과 같은 오류가 나옵니다.
아래는 답변으로 주신 수식입니다.
1
Plot1((V-V[1])/V[1]*100,"거래량전봉대비");
2
Plot1(M,"거래대금");
3
if Bdate != Bdate[1] Then
var1 = 0;
var1 = var1+m;
Plot1(var1,"당일거래대금");
4
Plot1(v,"거래량",IFf(V>V[1],Red,Blue));
2022-10-04
1116
글번호 162719
답변완료
문의 드립니다.
input : 익절틱수(160),손절틱수(100);
if NextBarSdate != sDate Then
{
if NextBarOpen > C Then
{
Buy("b",AtStop,NextBarOpen+PriceScale*10);
Sell("s",AtStop,NextBarOpen-PriceScale*10);
}
if NextBarOpen < C Then
{
ExitLong("bx",AtStop,NextBarOpen-PriceScale*10);
ExitShort("sx",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 Then
Sell("ss",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("ss1",AtStop,EntryPrice+10);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if NextBarSdate != sDate Then
{
if NextBarOpen > C Then
{
Buy("b2",AtStop,NextBarOpen+PriceScale*10);
Sell("s2",AtStop,NextBarOpen-PriceScale*10);
}
if NextBarOpen < C Then
{
ExitLong("bx2",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx2",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 Then
Sell("sss",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("sss1",AtStop,EntryPrice+10);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if NextBarSdate != sDate Then
{
if NextBarOpen < C Then
{
Buy("b8",AtStop,NextBarOpen+PriceScale*10);
Sell("s8",AtStop,NextBarOpen-PriceScale*10);
}
if NextBarOpen > C Then
{
ExitLong("bx8",AtStop,NextBarOpen-PriceScale*10);
ExitShort("sx8",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 Then
Sell("bb",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("bb1",AtStop,EntryPrice+10);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if NextBarSdate != sDate Then
{
if NextBarOpen < C Then
{
Buy("b9",AtStop,NextBarOpen+PriceScale*10);
Sell("s9",AtStop,NextBarOpen-PriceScale*10);
}
if NextBarOpen > C Then
{
ExitLong("bx9",AtStop,NextBarOpen-PriceScale*10);
ExitShort("sx9",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 Then
Sell("bbb",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("bbb1",AtStop,EntryPrice+10);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
-------------
늘 감사합니다.
체결내역을 보시면
1번 매수
2번 매수청산
3번 스위칭으로 매도
4번 매도청산
이렇게 이해하고있습니다.
5번 스위칭으로 매수 신호가 없는데 위 수식어에서 가능 유무를 문의 드립니다.
2022-10-04
943
글번호 162718
답변완료
수식 검토 부탁 드립니다
안녕하세요!
아래 만들어 주신 수식을 적용해 보니 표현이 안된 부분이 있어서 검토 부탁드립니다.
전 두 상품간의 가격의 차이를 실시간으로 가격값이 표시되어 나타나기를 원합니다.
그런데 가격 값이 수치로 나타나질 않습니다.
첨부 파일에 보면 파란색 박스안에 숫자(가격의 격차)처럼 나타내 주시길 부탁 드립니다.
var : ii(0,Data1),mm(0,Data1),tl1(0,Data1),tl2(0,Data1);
mm = (Data1(c)+data2(c))/2;
if CurrentDate == sDate Then
{
if Data1(sDate != sDate[1])Then
{
tl1 = TL_New(sDate,stime,Data1(c),NextBarSdate,NextBarStime,Data1(c));
TL_SetExtLeft(tl1,true);
TL_SetExtRight(tl1,true);
TL_SetColor(tl1,Lime);
tl2 = TL_New(sDate,stime,Data2(c),NextBarSdate,NextBarStime,Data2(c));
TL_SetExtLeft(tl2,true);
TL_SetExtRight(tl2,true);
TL_SetColor(tl2,Magenta);
}
Else
{
TL_SetBegin(tl1,sDate,sTime,Data1(c));
TL_SetEnd(tl1,NextBarSdate,NextBarStime,Data1(c));
TL_SetBegin(tl2,sDate,sTime,Data2(c));
TL_SetEnd(tl2,NextBarSdate,NextBarStime,Data2(c));
}
}
----------------------------------------------------------------------------
아래 피보나치의 수치 비율의 글자 색상 변경과 위치를 왼쪽, 오른쪽, 중간으로 설정할 수 있게 외부변수로 바꾸어 주시길 부탁드립니다.
매매시에 다른 색이 들어간 수식과 자주 겹쳐져 불편할 때가 있습니다.
input : Per1(23.6),Per2(38.2),Per3(50.0),Per4(61.8),Per5(76.4);
var : HH(0),LL(0),tx1(0),tx2(0),tx3(0),tx4(0),tx5(0),tx6(0),tx7(0);
HH = dayhigh;
LL = daylow;
if HH > 0 and LL > 0 then{
var1 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per1/100));
var2 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per2/100));
var3 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per3/100));
var4 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per4/100));
var5 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per5/100));
plot1(HH,"최고",Gray);
plot2(LL,"최저",Gray);
plot3(var1,"Per1%",Gray);
plot4(var2,"Per2%",Gray);
plot5(var3,"Per3%",Gray);
plot6(var4,"Per4%",Gray);
plot7(var5,"Per5%",Gray);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
tx1 = Text_New(sdate,stime,HH,"고");
tx2 = Text_New(sdate,stime,LL,"저");
tx3 = Text_New(sdate,stime,var1,NumToStr(Per1,1)+"%");
tx4 = Text_New(sdate,stime,var2,NumToStr(Per2,1)+"%");
tx5 = Text_New(sdate,stime,var3,NumToStr(Per3,1)+"%");
tx6 = Text_New(sdate,stime,var4,NumToStr(Per4,1)+"%");
tx7 = Text_New(sdate,stime,var5,NumToStr(Per5,1)+"%");
}
2022-10-04
1013
글번호 162707