커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
8061
글번호 230811
답변완료
수고하십니다
항상 노고에 감사하며
변환 부탁드립니다
indicator("Zero-Lag MA Trend Levels [ChartPrime]", overlay = true)
// --------------------------------------------------------------------------------------------------------------------}
// 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
int length = input.int(15, title="Length") // Length for the moving average calculations
bool show_levl = input.bool(true, "Trend Levels") // Toggle to show trend levels
// Colors for the trend levels
color up = input.color(#30d453, "+", group = "Colors", inline = "i")
color dn = input.color(#4043f1, "-", group = "Colors", inline = "i")
var box1 = box(na) // Variable to store the box
series float atr = ta.atr(200) // Average True Range (ATR) for trend levels
// --------------------------------------------------------------------------------------------------------------------}
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
series float emaValue = ta.ema(close, length) // EMA of the closing price
series float correction = close + (close - emaValue) // Correction factor for zero-lag calculation
series float zlma = ta.ema(correction, length) // Zero-Lag Moving Average (ZLMA)
bool signalUp = ta.crossover(zlma, emaValue) // Signal for bullish crossover
bool signalDn = ta.crossunder(zlma, emaValue) // Signal for bearish crossunder
// Determine the color of ZLMA based on its direction
color zlma_color = zlma > zlma[3] ? up : zlma < zlma[3] ? dn : na
color ema_col = emaValue < zlma ? up : dn // Determine the EMA color
// --------------------------------------------------------------------------------------------------------------------}
// 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{
// Plot the Zero-Lag Moving Average
p1 = plot(zlma, color = zlma_color, linewidth = 1) // Plot ZLMA
p2 = plot(emaValue, color = ema_col, linewidth = 1) // Plot EMA
fill(p1, p2, zlma, emaValue, color.new(zlma_color, 80), color.new(ema_col, 80)) // Fill between ZLMA and EMA
// Method to draw a box on the chart
method draw_box(color col, top, bot, price)=>
box.new(
bar_index, top, bar_index, bot, col, 1,
bgcolor = color.new(col, 90),
text = str.tostring(math.round(price, 2)),
text_size = size.tiny,
text_color = chart.fg_color,
text_halign = text.align_right
)
// Logic to draw trend levels as boxes on the chart
if show_levl
bool check_signals = signalUp or signalDn // Check if there is an up or down signal
switch
// Draw a box when a bullish signal is detected
signalUp => box1 := up.draw_box(zlma, zlma - atr, close)
// Draw a box when a bearish signal is detected
signalDn => box1 := dn.draw_box(zlma + atr, zlma, close)
switch
// Extend the right side of the box if no new signal is detected
not signalUp or not signalDn => box1.set_right(bar_index + 4)
=> box1 := box(na) // Otherwise, reset the box
switch
// Add a downward label when price crosses below the bottom of the box
ta.crossunder(high, box1.get_bottom()) and not check_signals[1] and not check_signals and emaValue > zlma=>
label.new(bar_index - 1, high[1], "▼", color = color(na), textcolor = dn, style = label.style_label_down)
// Add an upward label when price crosses above the top of the box
ta.crossover(low, box1.get_top()) and not check_signals and not check_signals[1] and emaValue < zlma=>
label.new(bar_index - 1, low[1], "▲", color = color(na), textcolor = up, style = label.style_label_up)
// Plot shapes for up and down signals
plotshape(signalUp ? zlma : na, "", shape.diamond, location.absolute, color = up, size = size.tiny)
plotshape(signalDn ? zlma : na, "", shape.diamond, location.absolute, color = dn, size = size.tiny)
// --------------------------------------------------------------------------------------------------------------------}
2024-10-30
1572
글번호 184815
답변완료
종목검색식 부탁드림니다.
항상 노고에 감사드림니다.
아래의 수식을 종목검색식으로 부탁드림니다.
A1 =ma(C, 2);
A2 =ma(C, 20);
A3 =ma(C, 60);
이격률 =A2/A3*100-100;
조건=
H> C(1)*1.15 &&
C> C(1)*1.1 &&
거래대금>=10000 &&
RSI(14)>=70;
조건 &&
Crossup(C, A2 && Crossup(C, A3) &&
이격률> -7 && 이격률 <7)
2024-10-31
884
글번호 184814
답변완료
키움의 지표를 Yes에 만들고 싶습니다. 부탁드립니다.
수고하십니다. 아래 키움의 지표 수식을 예스에 구현하고 싶습니다.
부탁드립니다.
키움 수식 : 상,하 2개 지표를 만들고 싶습니다.
기준봉=C/C(1)*100-100>=상승율 && 거래대금/100>=기준액 ;
HC=highest(C,상기간) ;
LL=lowest(L,하기간) ;
Bnt=BarsSince(C==HC) ;
상=valuewhen(1,기준봉 && HC,HC) ;
하=valuewhen(1,LL>0,LL) ;
수고하세요
2024-10-30
945
글번호 184813
답변완료
문의 드립니다
안녕하세요
트레이딩지표 전환 부탁드립니다
1.
res1 = input(title="Close Time Frame", type=resolution, defval="D")
cld=security(tickerid, res1, close[1])
opd=security(tickerid,res1, open[1])
tu=(cld +opd)/2
plot( tu, "Breakout",color=black ,style=line,linewidth=2,transp=0)
2.다음지표에 현재가을 추가해주세요
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(1);#1:SMA 0:RMA
var : src(0),alpha(0),source(0),ATR1(0),ATR2(0),ATRV(0);
var : up(0),up1(0),dn(0),dn1(0),trend(0),tx(0);
src = (H+L)/2;
alpha = 1 / Periods;
atr1 = IFf(IsNan(atr1[1]) == true , ma(TrueRange, Periods) , alpha * TrueRange + (1 - alpha) * atr1[1]);
atr2 = ATR(Periods);
atrv = IFf(changeATR == 1 , atr1 , atr2);
up=src-(Multiplier*atrv);
up1 = IFf(IsNan(up[1]) == False,up[1],up);
up = iff(close[1] > up1 , max(up,up1) , up);
dn=src+(Multiplier*atrv);
dn1 = IFf(IsNan(dn[1]) == False,dn[1], dn);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = IFf(IsNan(trend[1]) == False,trend[1], trend);
trend = IFf(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"UpTrend",green);
Else
NoPlot(1);
if trend == -1 then
Plot2(dn,"Down Trend",red);
Else
NoPlot(2);
if trend == 1 and trend[1] == -1 Then
{
tx =Text_New(sDate,sTime,up,"●");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,Green);
}
if trend == -1 and trend[1] == 1 Then
{
tx =Text_New(sDate,sTime,dn,"●");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,Red);
}
감사합니다
2024-10-31
901
글번호 184812
2wnwn 님에 의해서 삭제되었습니다.
2024-10-30
37
글번호 184811
답변완료
추가 질문드립니다.
1.첨부파일에서 a지표가 기준선을 cross down 하기 직전 a지표의 가장 높은 고점을 표현 할 수 있는가요?
89736번 질문에서 제가 질문을 잘못 드린 것 같습니다. 보조지표로 그리는 게 아니구
cross down 하기 직전의 a지표의 가장 높은 고점값을 수식에 자동으로 인식하여 직전고점이 얼마 이하면 진입을 제한해보려고 합니다. 고점값을 구하는 식을 좀 부탁드립니다.(참고로 vr지표입니다.기준선은 300 입니다.)
2024-10-30
981
글번호 184810
답변완료
순매수체결량 30분전보다 우상향 검색식
안녕하세요
순매수체결량을 어찌어찌해서 잘 활용하고 있습니다
//Upvol "상승형 체결거래량";
//DownVol "하락형 체결거래량"
input: 막대굵기 (1);
var : sumPL(0);
if sDate != sDate[1] Then
{
sumPL = 0;
}
Else
{
sumPL = sumPL + (Upvol-DownVol);
if sumPL > 0 Then
Plot1(sumPL, "순매수체결량", RgB(255,0,0), Def, 막대굵기 );
Else
Plot1(sumPL, "순매수체결량", RgB(0,0,255), Def, 막대굵기 );
}
PlotBaseLine1(0, "기준선0");
지표수식은 위에 것으로 쓰고 있지만 뭐가 뭔지 거의 모릅니다
이걸 종목검색으로 활용하고 싶어서 순매수체결량이 30분전보다 증가한 종목을 찾고 싶어서 검색식을 만들어볼려고 합니다
아래부분에다
if var1>var1[30] then
find(1);
이렇게 붙여넣으면 될 줄 알았는데 검증을 클릭하면 오류라고 뜨네요
도움을 주실 수 있는지요? 꾸벅
2024-10-30
930
글번호 184807
답변완료
문의 드립니다.
//@version=5
indicator(
"Fourier For Loop [BackQuant]",
shorttitle="",
overlay=false,timeframe="",
timeframe_gaps=true
)
const string ui = "UI Settings"
const string inputs = "Calculation Settings"
const string scoring = "Signals"
xval = input.source(hlc3, "Calculation Source", group = inputs, inline = "2222")
N = input.int(1, minval=1, title="Calculation Period", group = inputs, inline = "2222")
start = input.int(1, "Calculation Start", group = inputs,inline = "1s")
end = input.int(45, maxval = 50, title = "Calculation End", group = inputs,inline = "1s")
upper = input.int(40, "Long Threshold",group = scoring)
lower = input.int(-10, "Short Threshold",group = scoring)
simple bool showthres = input.bool(true, "Show Threshold Lines?", group = ui)
simple bool paintCandles = input.bool(false, "Color Bars According to Trend?", group = ui)
simple bool bgcol_ = input.bool(false, "Background Colour", group = ui)
int linew = input.int(3, "Signal Line Width", 1,4,1, group = ui)
color longcol = input.color(#00ff00, "Long Colour", group = ui, inline = "xxxx")
color shortcol = input.color(#ff0000, "Short Colour", group = ui, inline = "xxxx")
DFT(x, y, Nx, _dir) =>
float _arg = 0.0
float _cos = 0.0
float _sin = 0.0
float xArr_i = 0.0
float yArr_i = 0.0
xArr = array.new_float(array.size(x))
yArr = array.new_float(array.size(y))
for i = 0 to Nx - 1 by 1
xArr_i := 0.0
yArr_i := 0.0
kx = float(i) / float(Nx)
_arg := -_dir * 2 * math.pi * kx
for k = 0 to Nx - 1 by 1
_cos := math.cos(k * _arg)
_sin := math.sin(k * _arg)
xArr_i += array.get(x, k) * _cos - array.get(y, k) * _sin
yArr_i += array.get(x, k) * _sin + array.get(y, k) * _cos
yArr_i
array.set(xArr, i, xArr_i)
array.set(yArr, i, yArr_i)
if _dir == 1
for i = 0 to Nx - 1 by 1
array.set(x, i, array.get(xArr, i) / float(Nx))
array.set(y, i, array.get(yArr, i) / float(Nx))
else
for i = 0 to Nx - 1 by 1
array.set(x, i, array.get(xArr, i))
array.set(y, i, array.get(yArr, i))
x = array.new_float(N, 0.0)
y = array.new_float(N, 0.0)
for i = 0 to N - 1
array.set(x, i, xval[i])
array.set(y, i, 0.0)
DFT(x, y, N, 1)
mag = array.new_float(N, 0.0)
for i = 0 to N - 1
mag_i = math.sqrt(math.pow(array.get(x, i), 2) + math.pow(array.get(y, i), 2))
array.set(mag, i, mag_i)
subject = array.get(mag,0)
forloop(start, end) =>
return_val = 0.0
for i = start to end by 1
return_val += (subject > subject[i] ? 1 : -1)
return_val
return_val
score = forloop(start, end)
L = score > upper
S = ta.crossunder(score, lower)
var out = 0
if L and not S
out := 1
if S
out := -1
plot(score, "FFL", color = out == 1 ? longcol : out == -1 ? shortcol : color.gray, linewidth = linew)
barcolor(paintCandles ? (out == 1 ? longcol : out == -1 ? shortcol : color.gray) : na)
plot(showthres?upper:na, "Long Threshold", longcol)
plot(showthres?lower:na, "Short Threshold", shortcol)
bgcolor(bgcol_?(out == 1 ? color.new(longcol,90) : out == -1 ? color.new(shortcol,90) : color.gray):na)
alertcondition(L and not S, title="Fourier FL Long", message="Fourier FL Long - {{ticker}} - {{interval}}")
alertcondition(S, title="Fourier FL Short", message="Fourier FL Short - {{ticker}} - {{interval}}")
트레이딩뷰 수식인데 예스로 좀 바꿔주세요.
2024-10-30
1112
글번호 184806
답변완료
질문 드리겠습니다
지난 답변 감사드립니다
몇가지 더 여쭤보고 싶은데요
질문1.
if t == -1 Then
{
if h > hh Then
hh = h;
if l < ll Then
ll = l;
IF H > M2 TheN PLOT11(HIGH,"HIGH",Cyan,DeF,1);
# ElsE NoPloT(11);
}
이 부분에서 고가가 M2 (이평선) 보다 높을때 PLOT11로 출력을 했는데요
추세선 TL1 TL2 으로 표현한 구간( 두개의 MA 가 crossdown 했다가 up 하는 구간) 이 아닌 곳에서는 NOPLOT 을 하려면 어떻게 해야될까요??
ELSE NOPLOT(11); 을 추가해봤는데 안되네요.
*NOPLOT으로 값은 없지만(n/a) 두개의 지점을 이어주는 선을 없앨 수 있지 않나요??
질문2.
1번 질문에서의 IF H>M2 가 해당될때의 HIGH 값들 중에서 ,최고 HIGH 와 최저 HIGH 를 표시하고 싶습니다
질문3. 추세선 구간에 해당되지 않는 부분 (조건 만족하지 않는 봉들)에서의 최고 최저값을 작성하고 싶습니다. (최고가는 MA5 보다 클 때만 ). 추세선 구간을 지나는 연결선은 NOPLOT 으로 처리해주세요. 감사드립니다
[아래는 수식입니다]
VAR : P1(0),P2(0);
var : m1(0),m2(0),T(0),HH(0),LL(0);
var : upd(0),upt(0),dnd(0),dnt(0),TL1(0),TL2(0);
P1=5;
P2=30;
m1 = ma(C,P1);
m2 = ma(C,P2);
#이평
Plot1(M1,"M1",Green,DeF,1);
plot2(M2,"M2",OrangE,DeF,1);
if CrossUp(m1,m2) Then
{
T = 1;
upd = sDate;
upt = sTime;
value1 = hh;
Value2 = ll;
#직전 데드와 골드사이에는 추세선으로 출력
TL1 = TL_New(dnd,dnt,hh,upd,upt,hh);
TL_SetColoR(TL1,YelloW);
TL_SetSizE(TL1,1);
TL2 = TL_New(dnd,dnt,ll,upd,upt,ll);
TL_SetColoR(TL2,YelloW);
TL_SetSizE(TL2,1);
#Plot11(HIGH,"HIGH1",RED,DeF,1);
#plot3(value1,"HH EXT",LightGreen,DeF,1);
#plot4(LL,"LL EXT",BluE,DeF,1);
}
if CrossDown(m1,m2) Then
{
T = -1;
hh = h;
ll = l;
dnd = sDate;
dnt = sTime;
}
if t == -1 Then
{
if h > hh Then
hh = h;
if l < ll Then
ll = l;
IF H > M2 TheN PLOT11(HIGH,"HIGH",Cyan,DeF,1);
}
2024-10-31
935
글번호 184805