커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1586
글번호 230811
답변완료
문의 드립니다
input : starttime(160000),endtime(60000),n(30);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0);
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;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
input : 익절틱수(60),손절틱수(15);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Sell("s",AtStop,NextBarOpen+PriceScale*10);
}
}
ExitShort("sx",AtMarket);
if NextBarOpen != C Then
{
Sell("s1",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx1",AtMarket);
if NextBarOpen != C Then
{
Sell("s3",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx3",AtMarket);
if NextBarOpen == C Then
{
Sell("s4",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx4",AtMarket);
if NextBarOpen == C Then
{
Sell("s5",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx5",AtMarket);
if NextBarOpen == C Then
{
Sell("s6",AtStop,NextBarOpen+PriceScale*10);
}
ExitShort("sx6",AtMarket);
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
위 수식어를 120분봉 매매에 사용중입니다.
익절 하나하나의 합이 300틱일때 매매정지가 가능한 수식어를
추가할 수 있는지 문의 드립니다.
2023-01-25
840
글번호 165602
답변완료
문의드립니다
수고가 많으십니다.
예스랭귀지 초보인지라 몇가지 문의를 드리고자 합니다.
1-1. 당일과 전일의 주요 지표값 등 출력
①당일 시가
②당일 고가
③당일 저가
④당일 중앙선(당일 저점과 당일 고점의 중간값)
⑤전일 시가
⑥전일 고가
⑦전일 저가
⑧전일 중앙선
⑨전일 종가
를 차트에 선으로 출력하고, 당일 시가, 당일 고가 등등으로 표식도 함께 출력하고 싶습니다.
⑩파라볼릭(종가) ==> 기본지표에 있는 파라볼릭(종가)임
⑪ 5 이평선
⑫ 20 이평선
⑬ 60 이평선
⑭ 120 이평선
은 텍스트 표식없이 함께 출력하고싶습니다.
(파라볼릭은 원본 그대로 캔들주변의 작은 점으로 표기하되, 색상과 두께 조절이 가능하게, 변수인 af 와 maxAf 는 변수편집 기능까지 가능하게)
(5/10/20/60/120 기본 이평선은 필요시 10, 30, 200 이평선 등등으로 이평선을 조정할 수 있도록 변수? 취급하여 편집기능까지)
== > 결론: 위의 지표들을 하나의 세트로 묶고자 함
1-2. 위 "1-1" 의 당일/전일 주요 지표값 등의 전부를
"지표속성"의 "차트표시"에서 체크박스로 만들어서 선택적으로 출력하고 싶고,
라인색과 두께도 함께 조절하고 싶습니다.
2-1. 당일과 전일의 일봉/주봉/월봉 값을 차트에 출력하고 싶습니다.
①"틱"차트에서 당일의 일봉(5일, 10일, 20일, 60일, 120일, 200일)
주봉(5주, 10주, 20주, 60주, 120주, 200주)
월봉(5월, 10월, 20월, 60월, 120월, 200월)
②"분"차트에서 당일의 일봉(5일, 10일, 20일, 60일, 120일, 200일)
주봉(5주, 10주, 20주, 60주, 120주, 200주)
월봉(5월, 10월, 20월, 60월, 120월, 200월)
==> 위 2-1의 ①, ② 경우, 차트 우측에 5일, 10일, 20일.... 5주, 10주, 20주.. 5월, 10월 20월... 등의 표식도 함께 출력하고 싶습니다.
2-2. 아울러 앞의 사례와 마찬가지로,
일봉(5일, 10일, 20일, 60일, 120일, 200일)/ 주봉(5주, 10주, 20주, 60주, 120주, 200주)/ 월봉(5월, 10월, 20월, 60월, 120월, 200월) 값을
"지표속성"의 "차트표시"에서 체크박스로 만들어서 선택적으로 출력하고 싶고,
라인색과 두께도 함께 조절하고 싶습니다.
3-1. 그리고 끝으로 저번 80428 에 대한 추가 질의를 드리고자 합니다.
원 질의(80428)에서 "3-1" 실행시 에러가 나는데요..
(첨부된 그림 화일 참조)
[답변 내용중 일부 발췌]
3-1
아래 구조로 식을 작성하시면
10시15분에 시작해서 03시 50분 청산하게 됩니다.
input : ntime(101500),EndTime(35000);
var : Tcond(false);
====> 여기서 첫줄. input문을
input : StartTime(101500),EndTime(035000);
이렇게 수정하니 에러가 안나는데..
이렇게 수정해서 사용하는게 맞는거죠? ^^
3-2. 아울러 답변으로 올려주신 수식은 다 잘 되는데.. 가끔 "0틱 수익"이 찍힙니다. 이건 어떻게 잡아야 될까요?
2023-09-06
1038
글번호 165601
답변완료
지표와 검색식 부탁드립니다.
안녕하세요.
1-수식 변환 요청드립니다.
B=sum(V);
B2=valueWhen(1,date(1)!=date,B(1));
A=B-B2;
B3=valueWhen(1,date(1)!=date,A(1));
b3;
a=sum(v);
a2=valueWhen(1,date(1)!=date,a(1));
p=a-a2;
crossup(p,b3)
2-5분봉에서 위에 수식이 나왔던 캔들을 기준봉으로 삼고
주가가 기준봉 밑으로 빠졌다가 돌파하는 검색식 요청드립니다.
감사합니다.
새해복많이 받으세요~
2023-01-20
952
글번호 165600
답변완료
행복; 지표식 작성 바랍니다
한국의 금융산업 발전을 위해 불철주야 애쓰시는 귀하의 노고를 높이 평가합니다
지표식 관련입니다
codecategoryEx에 대한 질문입니다
수식작성 Q&A 에서 "2012년 6월 5일 CodeCategoryEx 코드표"를 보았습니다
=====================================================================
현행 코드표는 <아래>와 같습니다.
kospi 종목 : 11
kosdaq 종목 : 12
ETF : 13
kospi선물 : 21
스타지수 : 22
주식선물 : 26
kospi 콜옵션 32
Kospi 풋옵션 32
kospi 관련 지수는 51
kosdaq 관련 지수는 52
해외데이터 61
참조데이터 72
참조데티어 중 ATM 연결콜풋 : 71
ELW : 15
다음버전이 출시되면 아래 내용으로 변경되어
도움말에 추가될 예정입니다.
11 : KOSPI 종목
12 : KOSDAQ 종목
13 : ETF_KOSPI
14 : ETF_KOSDAQ
15 : ELW
21 : FUTURE_KOSPI
22 : FUTURE_KOSDAQ
23 : FUTURE_SPOT
25 : SPREAD_KOSPI
26 : SPREAD_SPOT
31 : OPTION_KOSPI_CALL
32 : OPTION_KOSPI_PUT
33 : OPTION_KOSDAQ_CALL
34 : OPTION_KOSDAQ_PUT
35 : OPTION_종목
51 : KOSPI 계열 지수
52 : KOSDAQ 계역 지수
61 : 해외 데이터
71 : 참조데이터 중 거래가능종목 //연결콜/풋
72 : 참조데이터 중 거래불가종목 //외국인순매수금액과 같은 데이터
73 : 참조데이터 중 본인이 추가한 데이터
74 : 참조데이터 중 ATM연결 콜
75 : 참조데이터 중 ATM연결 풋
===========================================================
현재 위 아래 중 어느 것을 사용해야 하는지요?
아래 것을 사용해야 한다면 주식선물의 코드번호는 얼마인지요?
수고하십시요^^
뜻깊은 명절 되시기 바랍니다~
2023-01-20
1003
글번호 165598
답변완료
지표 부탁 드립니다.
안녕하세요
먼저 설을 맞이하여 올 한해도 뜻하시는바 모두 이루시길 기원합니다.
1. 볼밴과 삼각가중 지표를 합쳐서 표현 할 수 있는지요?
2. 위의 사항이 가능하다면 단순이평도 한 번 부탁드립니다.
볼밴과 이평을 합쳐서 색상 채우기를 해보려고 합니다.
고맙습니다.
2023-01-20
657
글번호 165597
답변완료
텍스트 위치
input : Period(110);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
var : box(0),box1(0);
Plot1(0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
box = box_new(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Lime);
Box_SetFill(box,true,40);
Text_SetSize(tx,25);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = text_new(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,30);
Text_SetBold(tx,1);
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date22 = date[0];
time22 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
Text_SetSize(tx,25);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = text_new(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,30);
Text_SetBold(tx,1);
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
1.박스 크기 숫자 표시 위치를 왼쪽으로 약간만 더 옮길수 있나요? setstyle 조정으로는 한계가 있네요.
2.바로 직전 상승박스를 돌파하는 새로운 상승 박스가 나오면, 돌파한 만큼의 폭을 그때 그때 수정하면서 직전 상승박스 상단 크기 표기된 숫자 위에 포개서 추가로 같이 표기.
하향돌파하면 반대로 바로 직전 하락박스 하단의 크기 표시 밑에 포개서 추가로 같이 표기. 감사합니다
2023-01-20
743
글번호 165596
답변완료
부탁드립니다.
1. 매월 옵션의 기준가를 수평선으로 구현해 주세요
2. 양옵션의 저가가 서로 같을 경우에 그 가격을 수평선으로 구현해 주세요
고맙습니다.
2023-01-19
789
글번호 165595
답변완료
수식 변환 문의
수고 하십니다.
아래 수식 변환 부탁드립니다.
수고하세요...
####################
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MensaTrader
//@version=5
indicator("Pivot Order Blocks", shorttitle="Pivot - OB", overlay=true, max_bars_back=500, max_boxes_count=250)
//Titles
inputGroupTitle = "=== Pivots ==="
plotGroupTitle = "=== Plots ==="
//Inputs
source = input.string("Wicks", options=['Wicks','Bodys'], title="Source", group=inputGroupTitle)
leftLenH = input.int(title="Pivot High", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle)
rightLenH = input.int(title="/", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle)
leftLenL = input.int(title="Pivot Low", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle)
rightLenL = input.int(title="/", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle)
boxLength = input.int(30, title="Box Size", tooltip="Amount of candles long", group=plotGroupTitle)
bullBoxColor = input.color(color.new(#00E600,90), title="Bullish Box Color", group=plotGroupTitle, inline="1")
bearBoxColor = input.color(color.new(#FF0000,90), title="Bearish Box Color", group=plotGroupTitle, inline="1")
//Wick / Body option
phOption = source == "Wicks" ? high : close
plOption = source == "Wicks" ? low : close
ph = ta.pivothigh(phOption,leftLenH, rightLenH)
pl = ta.pivotlow(plOption,leftLenL, rightLenL)
//Variables
var leftBull = bar_index
var rightBull = bar_index
var topBull = close
var bottomBull = close
var leftBear = bar_index
var rightBear = bar_index
var topBear = close
var bottomBear = close
//Bear Box Calc
if ph
leftBear := bar_index-leftLenH
rightBear := bar_index-(leftLenH-boxLength)
topBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenH] : open[leftLenH]) : high[leftLenL]
bottomBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenH] : close[leftLenH]) : close[leftLenL] > open[leftLenL] ? close[leftLenL] : open[leftLenL]
//Bull Box Calc
if pl
leftBull := bar_index-leftLenL
rightBull := bar_index-(leftLenL-boxLength)
topBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenL] : open[leftLenL]) : close[leftLenL] > open[leftLenL] ? open[leftLenL] : close[leftLenL]
bottomBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenL] : close[leftLenL]) : low[leftLenL]
plotshape(pl, offset=-25)
if pl
bull = box.new(left=leftBull, right=rightBull, top=topBull, bottom=bottomBull, bgcolor=color.new(bullBoxColor,80), border_color=bullBoxColor)
if ph
bear = box.new(left=leftBear, right=rightBear, top=topBear, bottom=bottomBear, bgcolor=color.new(bearBoxColor,80), border_color=bearBoxColor)
2023-01-19
916
글번호 165594
답변완료
수정 부탁합니다
input : sto1(10),sto2(5),sto3(5);
var : stok(0),stod(0),tx(0);
stok = stochasticsK(sto1,sto2);
stod = stochasticsD(sto1,sto2,sto3);
plot1(stok,"slowk");
plot2(stod,"slowd");
PlotBaseLine1(20);
PlotBaseLine2(80);
if CrossUp(stok,stod) Then
{
tx = Text_New_Self(sDate,sTime,stok,"▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Red);
Text_SetSize(tx,20);
}
if CrossDown(stok,stod) Then
{
tx = Text_New_Self(sDate,sTime,stok,"▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Blue);
Text_SetSize(tx,20);
}
1.화살표를 기본차트에 표시되게 해주세요
한칸위 한칸아래 로요
2.화살표를 어떻게 불러오고 입력하나요?
감사합니다
명절 잘 보내세요~~
2023-01-19
803
글번호 165593