커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
6966
글번호 230811
답변완료
타주기 전환, 도지
1번 수식. (꼬리 삭제)
input : N(15);
var : S1(0),D1(0),TF(0),box(0),idx(0);
var : oo(0),hh(0),ll(0),TL1(0),TL2(0),clr(0),ii(0),TL(0);
Plot1(c);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
idx = 0;
}
Else
idx = idx+1;
if D1 > 0 then
{
TF = idx%N;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and TF < TF[1]) Then
{
oo = O;
hh = H;
ll = L;
box = Box_New(sDate,sTime,oo,NextBarSdate,NextBarStime,c);
ii = 1;
}
Else
{
ii = ii +1;
if h > hh Then
hh = h;
if l < ll Then
ll = l;
var1 = Round(ii/2,1);
Box_SetEnd(box,sDate,sTime,C);
}
if C > oo Then
clr = Red;
else if C < oo Then
clr = Blue;
Else
clr = Green;
Box_SetColor(box,clr);
Box_SetSize(box,1);
Box_SetFill(box,true,255);
}
타주기 박스가 상승 전환시(음봉 박스 후 첫 양봉 박스), 상승 박스 하단에 네모 표시.
계속 상승하다 하락 전환시, 하단(상승) 네모 지우고, 첫 하락 박스 상단에 네모 표시.
도지는 무시.
2번수식.(꼬리 포함)
input : N(15);
var : S1(0),D1(0),TF(0),box(0),idx(0);
var : oo(0),hh(0),ll(0),TL1(0),TL2(0),clr(0),ii(0),TL(0);
Plot1(c);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
idx = 0;
}
Else
idx = idx+1;
if D1 > 0 then
{
TF = idx%N;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and TF < TF[1]) Then
{
value1 = sDate;
value2 = sTime;
oo = O;
hh = H;
ll = L;
box = Box_New(value1,Value2,hh,NextBarSdate,NextBarStime,ll);
ii = 1;
}
Else
{
ii = ii +1;
if h > hh Then
hh = h;
if l < ll Then
ll = l;
var1 = Round(ii/2,1);
Box_SetBegin(box,value1,Value2,HH);
Box_SetEnd(box,sDate,sTime,LL);
}
if C > oo Then
clr = Red;
else if C < oo Then
clr = Blue;
Else
clr = Gold;
Box_SetColor(box,clr);
Box_SetSize(box,1);
Box_SetFill(box,true,255);
}
도지 박스 색상을 한가지(gold) 색에서, 직전 박스와 동일하게 해서 두가지 색으로 변경.
바로 직전 박스 색이 blue면 blue 색으로, red면 red 색으로 각각 변경.
상승중 도지는 red, 하락중 도지는 blue. 감사합니다.
2023-05-07
1045
글번호 168735
답변완료
문의 드립니다.
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
//created by: @Anil_Ozeksi
//developer: ANIL ÖZEKŞİ
//author: @kivancozbilgic
var : src(0);
src = close;
input : length(6),percent(5.1);
input : mav(5);//"1:SMA", "2:EMA", "3:WMA", "4:TMA", "5:VAR", "6:WWMA", "7:ZLEMA", "8:TSF"]);
var : valpha(0),vud1(0),vdd1(0),vUD(0),vdd(0),vCMO(0),varv(0);
var : wwalpha(0),WWMA(0);
var : zxLag(0),zxEMAData(0),ZLEMA(0);
var : lrc(0),LRs(0),TSF(0),MAvg(0);
valpha=2/(length+1);
vud1=iff(src>src[1] , src-src[1] , 0);
vdd1=iff(src<src[1] , src[1]-src , 0);
vUD=AccumN(vud1,9);
vDD=AccumN(vdd1,9);
vCMO= iff(isnan((vUD-vDD)/(vUD+vDD)) == true,0,(vUD-vDD)/(vUD+vDD));
varv =0.0;
varv = iff(isnan(valpha*abs(vCMO)*src) ==true,0,valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*iff(isnan(varv[1])==true,0,varv[1]);
wwalpha = 1/ length;
WWMA = 0.0;
WWMA = wwalpha*src + (1-wwalpha)*iff(isnan(WWMA[1])==true,0,WWMA[1]);
zxLag = iff(length/2==round(length/2,0) , length/2 , (length - 1) / 2);
zxEMAData = (src + (src - src[zxLag]));
ZLEMA = ema(zxEMAData, length);
TSF = LRL(src, length)+LRS(src, length);
if mav== 1 Then #SMA
{
MAvg = ma(src,Length) ;
}
if mav== 2 Then #Ema
{
Mavg = ema(src, Length);
}
if mav== 3 Then #Ema
{
Mavg = wma(src, Length);
}
if mav== 4 Then #Tma
{
Mavg = ma(ma(src, Ceiling(length / 2)), floor(length / 2) + 1);
}
if mav== 5 Then #VAR
{
Mavg = varv;
}
if mav== 6 Then #WWMA
{
Mavg = WWMA;
}
if mav== 7 Then #ZLEMA
{
Mavg = ZLEMA;
}
if mav== 8 Then #TSF
{
Mavg = TSF;
}
var : fark(0),longStop(0),longStopPrev(0),shortStop(0),shortStopPrev(0);
var : dir(0),MT(0),OTT(0),OTTC(0);
fark=MAvg*percent*0.01;
longStop = MAvg - fark;
longStopPrev = iff(isnan(longStop[1]) == true, longStop,longStop[1]);
longStop = iff(MAvg > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = MAvg + fark;
shortStopPrev = iff(isnan(shortStop[1]) == true, shortStop,shortStop[1]);
shortStop = iff(MAvg < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = 1;
dir = iff(isnan(dir[1])==true,dir,dir[1]);
dir = iff(dir == -1 and MAvg > shortStopPrev , 1 , IFf(dir == 1 and MAvg < longStopPrev , -1 , dir));
MT = iff(dir==1 , longStop , shortStop);
OTT= iff(MAvg>MT , MT*(200+percent)/200 , MT*(200-percent)/200 );
OTTC = IFf(OTT[2] > OTT[3] , green ,red);
plot1(MAvg,"Support Line",Blue);
plot2(IFf(isnan(OTT[2]) == true,0,OTT[1]), "OTT",OTTC);
위 수식에서 두 선이 교차하면 매수/매도 신호가 나오게 해주세요.
2023-05-05
1160
글번호 168734
답변완료
피봇 수식변경
늘 감사합니다.
아래의 수식을 data2용으로 변경해 주세요
input : ntime(83000);
Var : PP(0), R1(0),R2(0),R3(0),S1(0),S2(0),S3(0);
var : DH(0),DL(0),DC(0);
var : DH1(0),DL1(0),DC1(0);
if (sdate != sDate[1] and sTime >= ntime) or
(sDate == sDate[1] and sTime >= ntime and sTime[1] < ntime) Then
{
DH = H;
DL = L;
DH1 = DH[1];
DL1 = DL[1];
DC1 = DC[1];
}
if DH > 0 and H > DH Then
DH = H;
if DL > 0 and L < DL Then
DL = L;
DC = C;
if DH1 > 0 and DL1 > 0 Then
{
PP = (DH1 + DC1 + DL1 )/3; //피봇선
R1 = 2 * PP - DL1; //1차저항
R2 = PP+DH1-DL1; //2차저항
R3 = DH1 + 2*(PP - DL1); //3차저항
S1 = 2 * PP - DH1; //1차지지
S2 = PP-DH1+DL1; //2차지지
S3 = DL1 - 2*(DH1 - PP); //3차지지
plot1(PP,"피봇선");
plot2(R1,"1차저항");
plot3(R2,"2차저항");
plot4(R3,"3차저항");
plot5(S1,"1차지지");
plot6(S2,"2차지지");
plot7(S3,"3차지지");
}
감사합니다.
2023-05-04
1307
글번호 168733
답변완료
수정 부탁드립니다.
안녕하세요?
아래의 수식에
진입횟수, 익.손절(외부변수) 넣고싶습니다.
부탁드립니다
Var : value(0);
value = 0;
# 매수 / 매도청산
If CCI(9) > 0 Then
value = 1;
If MACD(12,26) > 0 Then
value = value+1;
If DIPlus(14) > DIMinus(14) Then
value = value+1;
If StochasticsK(12,5) > StochasticsD(12,5,5) Then
value = value+1;
# 매수/매도청산
If value >= 3 Then
{
Buy();
}
value = 0;
# 매도/매수청산
If CCI(9) < 0 Then
value = 1;
If MACD(12,26) < 0 Then
value = value+1;
If DIPlus(14) < DIMinus(14) Then
value = value+1;
If StochasticsK(12,5) < StochasticsD(12,5,5) Then
value = value+1;
If value >= 3 Then
{
Sell();
}
2023-05-04
1902
글번호 168732
답변완료
문의드립니다
LatestEntryPrice를 사용해서 최근 진입 가격을 불러올때
예를들어
1. 5월 6일 시점에서, 전략차트를 켜서 시스템적용하면 5월 4일에 주가 1만원에 매수신호가 뜸
2. 실제로는 5월 4일에는 차트를 안 켜놔서 매수주문 자체가 안나감
3. 매수를 5월 6일에 주가 1.5만원에 매수주문을 수동으로 내서, 체결이 됨
이럴 경우,LatestEntryPrice(0)을 사용하면
실제 체결된 가격인 1.5만원이 적용되나요?
아니면 실제와는 다르지만, 차트 상 진입시점이었던 5월 4일의 1만원이 적용될까요?
2023-05-04
1647
글번호 168730
답변완료
문의드립니다^^
아래 키움 수식 변환 부탁드립니다^^
1)
a=c;
b=(highest(high,midPeriod)+lowest(low,midPeriod))/2;
valuewhen(1,crossup(a,b),c)
지표조건
midperiod 26
2)
a=crossup(sar(af,maxAf),c) or crossdown(sar(af,maxAf),c);
valuewhen(1,a,avg(c,5))
지표조건
af 0.18
maxaf 0.2
2023-05-04
1410
글번호 168729
답변완료
중간가 이상 종가
감사합니다.
1
전일 기준 최근 20일(N일) 동안
"당일 저가와 고가의 중간가 이상에서 마감한 종가"가
N회 이상인 종목을 검색하고 싶습니다.
2
당일 기준으로 위 1번과 같이 검색하고 싶습니다
2023-05-04
1340
글번호 168721
절제9단 님에 의해서 삭제되었습니다.
2023-05-04
0
글번호 168719
답변완료
지표수식 변환 요청드립니다
수고하십니다.
아래지표식에서 타주기분지표가 종가완성봉기준으로 출력되도록 부탁드립니다.
그림참조
그림위=현 아래수식이용 예스챠트 출력화면(지표가 출렁거림),
그림아래=트레이딩뷰 동일지표 출력화면
//==============
input : 분(5),useClose1(true),length(1),mult(1);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(1),dir1(0) ;
var : truehighv(0),TrueLowv(0),hsatr(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0);
var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0);
var : longcolor(Crimson),shortcolor(Blue),tx(0);
Array : TrueRangev[100](0),AccumValue[100](0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
///
TF = TM%분;
///30분
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or
(Bdate == Bdate[1] and 분 == 1 and TM > TM[1]) Then
{
ii = ii +1;
For cnt = 99 DownTo 1
{
TrueRangev[cnt] = TrueRangev[cnt-1];
oo[cnt] = oo[cnt-1];
hh[cnt] = hh[cnt-1];
ll[cnt] = ll[cnt-1];
cc[cnt] = cc[cnt-1];
hsc[cnt] = hsc[cnt-1];
AccumValue[cnt] = AccumValue[cnt-1];
}
AccumValue[0] = AccumValue[0]+1;
oo[0] = o;
hh[0] = h;
ll[0] = l;
Xopen1 = xopen[1];
Xhigh1 = xhigh[1];
Xlow1 = xlow[1];
Xclose1 = xclose[1];
longStop1 = longStop[1];
ShortStop1 = shortStop[1];
dir1 = dir[1];
}
if hh[0] > 0 and h > hh[0] Then
hh[0] = h;
if ll[0] > 0 and l < ll[0] Then
ll[0] = l;
cc[0] = c;
if ii == 1 then
{
xOpen = oo[0];
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xHigh = MaxList(hh[0], xOpen, xClose);
xLow = MinList(ll[0], xOpen,xClose);
}
else
{
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xOpen = (xOpen1 + xClose1)/2 ;
xHigh = MaxList(hh[0], xOpen, xClose) ;
xLow = MinList(ll[0], xOpen, xClose) ;
}
hsc[0] = xclose ;
if ii > 1 Then
{
If xClose1 > xHigh then
TrueHighv = xClose1;
else
TrueHighv = xHigh;
If xClose1 < xLow then
TrueLowv = xClose1;
else
TrueLowv = xLow;
TrueRangev[0] = TrueHighv - TrueLowv;
}
if ii > 2 Then
{
if TrueRangev[length-1] > 0 Then
{
sum = 0;
For cnt = 0 to length-1
{
sum = sum + TrueRangev[cnt];
}
hsatr = sum/length;
}
atrv = mult * hsatr;
hv = 0;
lv = 0;
For cnt = 0 to length-1
{
if useClose1 == true Then
{
if hv == 0 or (hv > 0 and hsc[cnt] > hv) Then
hv = hsc[cnt];
if lv == 0 or (lv > 0 and hsc[cnt] < lv) Then
lv = hsc[cnt];
}
Else
{
if hv == 0 or (hv > 0 and hh[cnt] > hv) Then
hv = hh[cnt];
if lv == 0 or (lv > 0 and ll[cnt] < lv) Then
lv = ll[cnt];
}
}
longStop = hv - atrv;
longStopPrev = longStop1;
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = lv + atrv;
shortStopPrev = shortStop1;
shortStop = iff(hsc[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(hsc[0] > shortStopPrev , 1 ,iff(hsc[0] < longStopPrev , -1 , dir1));
}
}
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
//======================
2023-05-04
2098
글번호 168718