커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1603
글번호 230811
답변완료
문의드립니다
1 study("Supertrend", overlay = true, format=format.price, precision=2, resolution="")
2 Periods = input(title="ATR Period", type=input.integer, defval=10)
3 src = input(hl2, title="Source")
4 Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
5 changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)
6 showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)
7 highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
8 atr2 = sma(tr, Periods)
9 atr= changeATR ? atr(Periods) : atr2
10 up=src-(Multiplier*atr)
11 up1 = nz(up[1],up)
12 up := close[1] > up1 ? max(up,up1) : up
13 dn=src+(Multiplier*atr)
14 dn1 = nz(dn[1], dn)
15 dn := close[1] < dn1 ? min(dn, dn1) : dn
16 trend = 1
17 trend := nz(trend[1], trend)
18 trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
19 upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)
20 buySignal = trend == 1 and trend[1] == -1
21 plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0)
22 plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
23 dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)
24 sellSignal = trend == -1 and trend[1] == 1
25 plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0)
26 plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
27 mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
28 longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white
29 shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white
30 fill(mPlot, upPlot, title="UpTrend Highligter", color=longFillColor)
31 fill(mPlot, dnPlot, title="DownTrend Highligter", color=shortFillColor)
32 alertcondition(buySignal, title="SuperTrend Buy", message="SuperTrend Buy!")
33 alertcondition(sellSignal, title="SuperTrend Sell", message="SuperTrend Sell!")
34 changeCond = trend != trend[1]
35 alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend has changed direction!")
위수식을예스트레이더로변경부탁드립니다~~
2022-12-11
951
글번호 164504
답변완료
수식 수정 좀 해주세요.
input : st_mult(2),st_period(14),len(20);
var : price(0),up_lev(0),dn_lev(0),upz(0),downv(0);
var : trur(0),plus(0),minus(0),sum(0),adxv(0);
var : di(0),x(0),zz(0);
price = (H+L)/2;
up_lev = price - (st_mult * atr(st_period));
dn_lev = price + (st_mult * atr(st_period));
if CurrentBar >= 1 then
{
upz = up_lev-up_lev[1];
downv = -(dn_lev-dn_lev[1]);
trur = (TrueRange + (len - 1) * trur) / len;
var1 = iff(upz > downv and upz > 0 , upz , 0);
var11 = (var1 + (len - 1) * var11) / len;
plus = var11/trur;
var2 = iff(downv > upz and downv > 0 , downv , 0);
var22 = (var2 + (len - 1) * var22) / len;
minus = var22/trur;
sum = plus + minus;
var3 = abs(plus - minus) / iff(sum == 0 , 1 , sum);
adxv = (var3 + (len - 1) * adxv) / len;
di = plus - minus;
x=adxv-di*100;
zz=x/-1;
plot1(zz,"시그널");
plot2(20,"상단");
plot3(-20,"하단");
plot4(0,"중심");
오류 메세지가 나옵니다.
내용은 올린 이미지입니다.
정상적으로 나오도록 수정 좀 해주세요.
2022-12-11
1008
글번호 164502
아트정 님에 의해서 삭제되었습니다.
2022-12-12
16
글번호 164501
답변완료
문의드립니다.
아래와 같은 수식을 사용하면 해당되는 영역에만 선이 그어지고 해당되지 않는 영역에는 선이 그어지지 않습니다. 그런데 "채우기" 기능을 사용하니까 해당되지 않는 영역에도 색깔이 채워지는데 해당되지 않는 영역에는 채우기가 안되도록 하려면 어떻게 해야 하는지 도움을 부탁드립니다.
if CountIf(C>O,3) == 3 Then
{
if T[3] != 1 Then
{
하단선 = O[2];
}
상단선 = C;
}
if 하단선 > 0 Then
{
Plot1(상단선);
plot2(하단선);
}
2022-12-11
968
글번호 164500
답변완료
수식 부탁합니다~
수고하십니다~
아래식은 알다시피
전20일동안 20퍼이상양봉 종목중에서 현재종가가 20이평근처 4%안에 들어와 있는 종목인데요.. 다른이평선도 or로 혼합 할려고하는데 안되서요..
(20이평근처 4%) or (3이평근처 3%) or (5이평근처 4%) or (10이평근처 4%) or ( 60이평근처 4%) or (120이평근처 4%) or (240이평근처 4%)
이렇게 수식좀 합해주시면 고맙겠습니다~
input : Period(20),Percent(4);
var : mav(0);
mav = ma(C,Period);
if C >= 900 and C <= 200000 and
CountIf(C>=C[1]*1.20,20)[1] >= 1 and
C >= C[1]*0.95 and
C <= mav*(1+Percent/100) and C >= mav*(1-Percent/100)and
O <= C[1]*1.07 Then
Find(1);
2022-12-11
1130
글번호 164499
답변완료
문의 드립니다.~~~~
조건식1에서 수익또는 손실이 연속 n회 나는 것을 조건으로
조건식2가 실행되게 하는 방법은 어떻게 하나요?
2022-12-11
1372
글번호 164498
답변완료
수식도움 부탁드립니다.
////////////트레이딩뷰 원 수식
//Heiken Ashi Candles
data = heikenashi(tickerid)
resLT = input(title="Res LT", type=resolution, defval="D")
resMT = input(title="Res MT", type=resolution, defval="240")
LTo = security(data, resLT, open)
LTc = security(data, resLT, close)
MTo = security(data, resMT, open)
MTc = security(data, resMT, close)
LTlong = LTc > LTo
LTshort = LTc < LTo
MTema20 = ema(MTc,20)
MTema20delta= change(MTema20)
MTlong = MTc > MTo and MTc > MTema20 and MTema20delta > 0
MTshort = MTc < MTo and MTc < MTema20 and MTema20delta < 0
Long = MTlong and LTlong
Short = MTshort and LTshort
plot(Long ? 1 : Short ? -1: 0, title="TrendAlert", color= Long ? lime : Short ? red : gray, style=columns )
############
////////////// 제가 변환 해본 수식
# 변환하는데 잘 몰라서 오류가 있는 듯한데
#점검 부탁드립니다.
////////////////
input : 분1(60),분2(15),period(20);
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0);
var : xClose2(0),xOpen2(0),xHigh2(0),xLow2(0);
var : xClose21(0),xOpen21(0),xHigh21(0),xLow21(0);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),ii(0),ii2(0);
var : sum(0), mav(0),mavdelta(0);
var : TrendAlert(0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0);
Array : oo2[100](0),hh2[100](0),ll2[100](0),cc2[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;
///
TF1 = TM%분1;
TF2 = TM%분2;
///15분
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and 분1 > 1 and TM >= TM[1]+분1) or
(Bdate == Bdate[1] and 분1 == 1 and TM > TM[1]) Then
{
ii = ii +1;
For cnt = 99 DownTo 1
{
oo[cnt] = oo[cnt-1];
hh[cnt] = hh[cnt-1];
ll[cnt] = ll[cnt-1];
cc[cnt] = cc[cnt-1];
}
oo[0] = o;
hh[0] = h;
ll[0] = l;
Xopen1 = xopen[1];
Xhigh1 = xhigh[1];
Xlow1 = xlow[1];
Xclose1 = xclose[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) ;
}
#####5분
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and 분2 > 1 and TM >= TM[1]+분2) or
(Bdate == Bdate[1] and 분2 == 1 and TM > TM[1]) Then
{
ii2 = ii2 +1;
For cnt = 99 DownTo 1
{
oo2[cnt] = oo2[cnt-1];
hh2[cnt] = hh2[cnt-1];
ll2[cnt] = ll2[cnt-1];
cc2[cnt] = cc2[cnt-1];
}
oo2[0] = o;
hh2[0] = h;
ll2[0] = l;
Xopen21 = xopen2[1];
Xhigh21 = xhigh2[1];
Xlow21 = xlow2[1];
Xclose21 = xclose2[1];
}
if hh2[0] > 0 and h > hh2[0] Then
hh2[0] = h;
if ll2[0] > 0 and l < ll2[0] Then
ll2[0] = l;
cc2[0] = c;
if ii == 1 then
{
xOpen2 = oo2[0];
xClose2 = (oo2[0]+hh2[0]+ll2[0]+cc2[0])/4;
xHigh2 = MaxList(hh2[0], xOpen2, xClose2);
xLow2 = MinList(ll2[0], xOpen2,xClose2);
}
else
{
xClose2 = (oo2[0]+hh2[0]+ll2[0]+cc2[0])/4;
xOpen2 = (xOpen21 + xClose21)/2 ;
xHigh2 = MaxList(hh2[0], xOpen2, xClose2) ;
xLow2 = MinList(ll2[0], xOpen2, xClose2) ;
}
if CC2[period-1] > 0 then
{
sum = 0;
for cnt = 0 to period-1
{
sum = sum+CC[cnt];
}
mav = sum/period;
mavdelta = mav - mav[1];
}
}
if xclose > xopen
and xclose2 > xopen2
and xclose2 > mav
and mavdelta > 0
Then TrendAlert = 1 ;
if xclose < xopen
and xclose2 < xopen2
and xclose2 < mav
and mavdelta < 0
Then TrendAlert = -1 ;
if trendalert == 1 Then
Plot1(TrendAlert,"TrendAlert",orange);
if trendalert == -1 Then
Plot1(TrendAlert,"TrendAlert",green);
2022-12-12
1544
글번호 164497
답변완료
부탁 드립니다
도움에 감사 드립니다.
그림과 같이 부탁 드립니다.
2022-12-11
1546
글번호 164496
답변완료
잘 부탁드립니다
input : n1(10),n2(21),obLevel1(60),obLevel2(53),osLevel1(-60),osLevel2(-53);
var : ap(0),esa(0),dd(0),ci(0),tci(0),wt1(0),wt2(0);
ap = (h+l+c)/3 ;
esa = ema(ap, n1);
dd = ema(abs(ap - esa), n1);
ci = (ap - esa) / (0.015 * dd);
tci = ema(ci, n2);
wt1 = tci;
wt2 = ma(wt1,4);
plot1(0,"0",GRAY);
plot2(obLevel1,"obLevel1",red);
plot3(osLevel1,"osLevel1",green);
plot4(obLevel2,"obLevel2",red);
plot5(osLevel2,"osLevel2",green);
plot6(wt1,"wt1",green);
plot7(wt2,"wt2",red);
plot8(wt1-wt2,"wt1-wt2",blue);
1, 0선 아래에서 골드나는 매수
2, -50 -60선 아래서 골드발생만 매수
3, wt1 이 wt2 를 골드 하는 매수 매도 시스템응 부탁 드립니다
### 언제나 항상 많은 도움 감사드립니다 ###
### 부족한 설명이 있거나 부족한것이 있다면 검토해서 잘 부탁드립니다###
2022-12-11
1408
글번호 164495