커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1541
글번호 230811
답변완료
수식 부탁드립니다.
아래 수식1 수식2에 23.6 38.2 61.8 76.4% 라인 추가로 부탁 드립니다.
수식1
input : length(50),hh(8),mult(3);
var : k(2),src(0),n(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0);
Var : tx1(0), tx2(0);
src = Close;
n = barindex;
//if IsLastBar업데이트 and barindex>length then
//y = 0
sume = 0;
for i = 0 to length-1
{
sum = 0;
sumw = 0;
for j = 0 to length-1
{
w = exp(-(pow(i-j,2)/(hh*hh*2)));
sum = sum+src[j]*w;
sumw = sumw+w;
}
y2 = sum/sumw;
sume = sume+abs(src[i] - y2);
}
mae = sume/length*mult;
if CrossDown(src,y2+mae) then
{
tx1 = Text_New_Self(sdate,stime,H,"▼");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,Blue);
Text_setsize(Tx1,30);
}
if CrossUp(src,y2-mae) then
{
tx2 = Text_New_Self(sdate,stime,L,"▲");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,Red);
Text_setsize(Tx2,30);
}
Plot1(y2);
Plot2(y2+mae);
Plot3(y2-mae);
수식2
input : length(130);
input : extend(30);
input : t_col(Magenta);
input : b_col(lime);
var : i(0),max_(0),min_(0),mid_(0),index_of_min(0),index_of_max(0);
var : alpha(0),ATRV(0);
var : TL1(0),TL2(0),TL3(0);
var : TX1(0),TX2(0),TX3(0),TX4(0),TX5(0),TX6(0),TX7(0);
var : box1(0),box2(0);
Array : mx[500](0),mn[500](0);
Array : TX[100](0);
alpha = 1 / 200 ;
ATRV = IFf(IsNan(ATrV[1]) == true, ma(TrueRange,200) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1]));
for i = 0 to length - 1
{
mx[i] = high[i];
mn[i] = low[i];
}
var1 = NthHighestArray(mx, length, 1, max_, index_of_max);
var2 = NthLowestArray(mn, length, 1, min_, index_of_min);
mid_ = avg(max_, min_);
#d.res_area := box.new(bar_index-length, max_+atr, bar_index+extend, max-atr, na, bgcolor = color.new(t_col, 80))
#d.sup_area := box.new(bar_index-length, min_+atr, bar_index+extend, min-atr, na, bgcolor = color.new(b_col, 80))
TL_Delete(TL1);
TL1 = TL_New(sDate[length],sTime[length],max_+ATRV*0.5,sDate,sTime,max_+ATRV*0.5);
TL_SetColor(TL1,t_col);
TL_Delete(TL2);
TL2 = TL_New(sDate[length],sTime[length],mid_,sDate,sTime,mid_);
TL_SetColor(TL2,Gray);
TL_SetStyle(TL2,3);
TL_Delete(TL3);
TL3 = TL_New(sDate[length],sTime[length],min_-ATRV*0.5,sDate,sTime,min_-ATRV*0.5);
TL_SetColor(TL3,t_col);
Text_Delete(TX1);
TX1 = Text_New(NextBarSdate,NextBarStime,max_,"▲"+NumToStr(max_,2));
Text_SetStyle(TX1,0,2);
Text_Delete(TX2);
TX2 = Text_New(NextBarSdate,NextBarStime,mid_,"▶"+NumToStr(mid_,2));
Text_SetStyle(TX2,0,2);
Text_Delete(TX3);
TX3 = Text_New(NextBarSdate,NextBarStime,min_,"▼"+NumToStr(min_,2));
Text_SetStyle(TX3,0,2);
Text_Delete(TX4);
TX4 = Text_New(sDate[length],sTime[length],max_,"Buy Power:"+NumToStr(CountIf(C>O,length),0));
Text_SetStyle(TX4,0,1);
Text_Delete(TX5);
TX5 = Text_New(sDate[length],sTime[length],min_,"Sell Power:"+NumToStr(CountIf(C<O,length),0));
Text_SetStyle(TX5,0,0);
Text_Delete(TX6);
TX6 = Text_New(sDate[index_of_max],sTime[index_of_max],max_,"X");
Text_SetStyle(TX6,2,1);
Text_Delete(TX7);
TX7 = Text_New(sDate[index_of_min],sTime[index_of_min],min_,"X");
Text_SetStyle(TX7,2,0);
Box_Delete(box1);
box1 = Box_New(sDate[length],sTime[length],max_+ATRV*0.5,sDate,sTime,max_-ATRV*0.5);
Box_SetColor(box1,t_col);
Box_SetFill(box1,true);
Box_Delete(box2);
box2 = Box_New(sDate[length],sTime[length],min_+ATRV*0.5,sDate,sTime,min_-ATRV*0.5);
Box_SetColor(box2,b_col);
Box_SetFill(box2,true);
var : low_1(0),low_2(0),high_1(0),high_2(0);
var : ii(0),top(0),bot(0);
top = min_+ATRV*0.5;
bot = max_-ATRV*0.5;
ii = 0;
for i = 0 to length -1
{
Text_Delete(TX[i]);
low_1 = low[i];
low_2 = low[iff(i>0 , i+1 , i)];
high_1 = high[i];
high_2 = high[iff(i>0 , i+1 , i)];
if low_1 > top and low_2 <= top Then
{
ii = ii+1;
TX[ii] = text_new(sdate[i],sTime[i],low_2, "◈");
Text_SetStyle(TX[ii],2,0);
}
if high_1 < bot and high_2 >= bot Then
{
ii = ii+1;
TX[ii] = text_new(sdate[i],sTime[i],high_2, "◈");
Text_SetStyle(TX[ii],2,1);
}
}
감사합니다.
2025-06-19
383
글번호 191938
답변완료
수식 부탁드립니다
지표식 부탁 드립니다.
indicator(title='Weighted Orderflow', precision = 3, overlay=false, explicit_plot_zorder = true)
// Input parameters
useSmoothing = input.bool(true, "Smooth OrderFlow?", group = "Calculation Parameters")
orderFlowWindow = input.int(12, minval=1, title='Order Flow Period', group = "Calculation Parameters")
smoothingLength = input.int(10, minval=1, title='Order Flow HMA Smoothing Length', group = "Calculation Parameters")
// Colors
upColor = input(#00ffbb, "Up Colour")
downColor = input(#ff1100, "Down Colour")
// Order Flow Calculation
efficiency = math.abs(close-open)/volume
orderFlow = math.sum((close > close[1] ? volume : (close < close[1] ? -volume : 0)) * efficiency, orderFlowWindow) / math.sum(efficiency, orderFlowWindow)
orderFlow := useSmoothing ? ta.hma(orderFlow, smoothingLength) : orderFlow
pine_vwrma(x, y) =>
ta.rma(x * volume, y) / ta.rma(volume, y)
// Standard Deviation Calculation
stdDev = ta.stdev(orderFlow, 45) * 1
normalizedOrderFlow = orderFlow/(stdDev + stdDev)
// Plotting Order Flow Columns
gap = 0.4
midu = plot(gap, "Basis", color = color.blue, display = display.none)
mmm = plot(0, "Basis", color = color.new(close > 0 ? upColor : downColor, 3), display = display.all)
midl = plot(-gap, "Basis", color = color.blue, display = display.none)
upu = plot(1.5+gap, "upper", color = color.blue, display = display.none)
uuu = plot(1.5, "upper", color = color.blue, display = display.none)
upl = plot(1.5-gap, "upper", color = color.blue, display = display.none)
lpu = plot(-1.5+gap, "lower", color = color.blue, display = display.none)
lll = plot(-1.5, "lower", color = color.blue, display = display.none)
lpl = plot(-1.5-gap, "lower", color = color.blue, display = display.none)
plot(math.avg(gap, 1.5-gap), "Upper Inter Range", color.new(chart.fg_color, 80), 1, plot.style_circles)
plot(math.avg(-gap, -1.5+gap), "Lower Inter Range", color.new(chart.fg_color, 80), 1, plot.style_circles)
fill(upu, uuu, 1.5+gap, 1.5, color.new(downColor, normalizedOrderFlow > 0 ? 20 : 60), color.new(downColor, normalizedOrderFlow > 0 ? 50 : 80), "Upper Cloud")
fill(upl, uuu, 1.52, 1.5-gap, color.new(downColor, 80), color.new(downColor, 99), "Upper Cloud")
fill(lpl, lll, -1.5, -1.5-gap, color.new(upColor, normalizedOrderFlow < 0 ? 50 : 80), color.new(upColor, normalizedOrderFlow < 0 ? 20 : 60), "lower Cloud")
fill(lpu, lll, -1.5+gap, -1.5, color.new(upColor, 99),color.new(upColor, 80), "lower Cloud")
transparencyControl1 = 30
chg1 = normalizedOrderFlow * 0.80
chg2 = normalizedOrderFlow * 0.60
chg3 = normalizedOrderFlow * 0.40
chg4 = normalizedOrderFlow * 0.20
plot(normalizedOrderFlow, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1+60), style = plot.style_columns, linewidth = 4)
plot(chg1, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1+55), style = plot.style_columns, linewidth = 4)
plot(chg2, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1+40), style = plot.style_columns, linewidth = 4)
plot(chg3, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1+30), style = plot.style_columns, linewidth = 4)
plot(chg4, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1+25), style = plot.style_columns, linewidth = 4)
plot(normalizedOrderFlow, color = color.new(normalizedOrderFlow > 0 ? upColor : downColor, transparencyControl1))
plotchar(ta.crossunder(normalizedOrderFlow, 1.5) ? 2.1 : na, "Bearish Reversal", "▼", location.absolute, downColor, size = size.tiny)
plotchar(ta.crossover(normalizedOrderFlow, -1.5) ? -2.1 : na, "Bullish Reversal", "▲", location.absolute, upColor, size = size.tiny)
2025-06-19
432
글번호 191936
답변완료
부탁드립니다
수고하십니다
예스로 부탁드립니다
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input.int(100, "Lookback Period")
float channel_width = input.float(1.5, "Channel Width", step = 0.1)
int channel_len = input(100, "Channel Length")
bool mid_disp = input.bool(true, "Mid Line", inline = "s")
bool fill_band = input.bool(true, "Fill Band", inline = "s")
color col1 = input.color(#21dfac, "", inline = "s1")
color col2 = input.color(#df216d, "", inline = "s1")
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
// Function to compute logarithmic regression
f_log_regression(src, length) =>
float sumX = 0.0
float sumY = 0.0
float sumXSqr = 0.0
float sumXY = 0.0
for i = 0 to length - 1
val = math.log(src[i])
per = i + 1.0
sumX += per
sumY += val
sumXSqr += per * per
sumXY += val * per
slope = (length * sumXY - sumX * sumY) / (length * sumXSqr - sumX * sumX)
average = sumY / length
intercept = average - slope * sumX / length + slope
[slope, intercept]
// Calculate slope and intercept
[slope, intercept] = f_log_regression(close, length)
float start = math.exp(intercept + slope * length)
float end = math.exp(intercept)
float diff = end - end[3]
float deviation = ta.stdev(close, length)
bool up_sig = ta.crossover(diff, 0) and barstate.isconfirmed
bool dn_sig = ta.crossunder(diff, 0) and barstate.isconfirmed
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
// Define Colors
color color_up = color.from_gradient(diff, ta.lowest(diff,200), ta.highest(diff,200), na, col1)
color color_dn = color.from_gradient(diff, ta.lowest(diff,200), ta.highest(diff,200), col2, na)
color channel_col = end > start ? col1 : col2
color trend_col = end > end[3] ? color_up : color_dn
color trend_col1 = end > end[3] ? col1 : col2
p1 = plot(end, "Log Regression", color = trend_col1, linewidth = 2)
p2 = plot(end[3], color = trend_col, display = display.none, editable = false)
plotshape(up_sig ? end : na, "Up", shape.xcross, location.absolute, chart.fg_color, size = size.tiny)
plotshape(dn_sig ? end : na, "Dn", shape.xcross, location.absolute, chart.fg_color, size = size.tiny)
fill(p1, p2, fill_band ? trend_col : na)
// Define upper and lower channel based on standard deviation
var line up1 = na
var line up = na
var line base = na
var line lw = na
var line lw1 = na
var label lbl_t = na
if na(base) and mid_disp
base := line.new(bar_index[channel_len], start, bar_index, end, style = line.style_dashed)
else
base.set_xy1(bar_index[channel_len], start)
base.set_xy2(bar_index, end)
base.set_color(chart.fg_color)
if na(up1)
up1 := line.new(bar_index[channel_len], start+deviation*(channel_width+0.3), bar_index, end + deviation*(channel_width+0.3), width = 3)
else
up1.set_xy1(bar_index[channel_len], start+deviation*(channel_width+0.3))
up1.set_xy2(bar_index, end + deviation*(channel_width+0.3))
up1.set_color(channel_col)
if na(up)
up := line.new(bar_index[channel_len], start+deviation*channel_width, bar_index, end + deviation*channel_width, width = 1)
else
up.set_xy1(bar_index[channel_len], start+deviation*channel_width)
up.set_xy2(bar_index, end + deviation*channel_width)
up.set_color(na)
if na(lw)
lw := line.new(bar_index[channel_len], start-deviation*channel_width, bar_index, end - deviation*channel_width, width = 1)
else
lw.set_xy1(bar_index[channel_len], start-deviation*channel_width)
lw.set_xy2(bar_index, end - deviation*channel_width)
lw.set_color(na)
if na(lw1)
lw1 := line.new(bar_index[channel_len], start-deviation*(channel_width+0.3), bar_index, end - deviation*(channel_width+0.3), width = 3)
lbl_t := label.new(bar_index[channel_len], start-deviation*(channel_width+0.3))
else
lw1.set_xy1(bar_index[channel_len], start-deviation*(channel_width+0.3))
lw1.set_xy2(bar_index, end - deviation*(channel_width+0.3))
lw1.set_color(channel_col)
lbl_t.set_xy(bar_index[channel_len], start-deviation*(channel_width+0.3))
lbl_t.set_text(end > start ? "UP" : "DN")
lbl_t.set_style((end < start ? label.style_label_lower_right : label.style_label_upper_right))
lbl_t.set_color(channel_col)
lbl_t.set_textcolor(#070f23)
// Fill Channel Upper and Lower Zones with color
linefill.new(lw, lw1, color.new(channel_col, 70))
linefill.new(up, up1, color.new(channel_col, 70))
// Info Dash
if barstate.islast
dash = table.new(position.top_right, 10, 10, bgcolor = color.new(chart.fg_color, 90), border_color = chart.bg_color, border_width = 5)
dash.cell(0, 0, "Slope: " + str.tostring(slope*100, "#,###.###"), text_color = chart.fg_color)
dash.cell(0, 1, "Log Regression Channel: " + (end > start ? "UP" : "DN"), text_color = channel_col)
dash.cell(0, 2, "Logarithmic Regression: " + (end > end[3] ? "UP" : "DN"), text_color = color.new(trend_col, 0))
// }
2025-06-19
348
글번호 191934
답변완료
시뮬레이션 돌리는 법 문의
안녕하세요?
시뮬레이션 돌리는 법 문의 드립니다.
실제 과거데이터로 시뮬레이션을 돌려 보면,
SetStopProfittarget(StopTrailingPrice, PointStop);
SetStopTrailing(1, StopTrailingPrice, PointStop);
은 아주 큰 차이를 보입니다.
실제 상황이랑, 이 2개 함수간에 어떤 차이가 있는지 알듯, 말듯 합니다.
그리고, 실제 상황과 가장 유사한, 추천하시는 시뮬레이션 방법에 대해 알려주십시요.
2025-06-19
341
글번호 191930
2685up 님에 의해서 삭제되었습니다.
2025-06-19
12
글번호 191929
답변완료
질문 부탁드립니다
답변감사합니다
plot((iff(condition3 == true,1,0)) 으로 확인을 해보면
하루중에 조건 (aa[0]<h and aa[0]>l) 을 만족하게 되는 봉이 나타나면 그 다음봉이
aa[0]<h and aa[0]>l 조건을 만족하지 않아도 계속 true 로 나타나고 다음 거래일이 되면 false 가 되는데요
분봉상 조건검색이 뭘 의미하는지 개념을 잘몰라서 그런지 뭔가 이해가 잘 안가는데요
조건만족시 Condition3를 true 로 설정해놓는것과 find 를 하는것의 관계를 잘 모르겠습니다
true 로 했다가 거래일이 변경되면 다시 false 로 리셋을 하는거 같은데..
"오늘 당일날 봉들중에서 하나라도 조건에 맞으면 검색하라 " 이런 의미는 아닌건가요?
if Bdate != Bdate[1] Then
{
Condition3=False;
}
...
if Condition3==False and (aa[1]<h and aa[1]>l) Then
{
Condition3=true;
Find(1);
}
질문2)
그럼 혹시 그냥 단순하게 분봉 차트로 봤을때, 지금 현재봉만 (가장 최근봉) 가지고 봤을때 aa[1]<h and aa[1]>l 조건 만족하는걸 찾게 하는건 안될까요?? 일봉에서 하는거처럼요.
그리고 질문1에서 말한거처럼 분봉상 당일날 한번이라도 그런봉이 나오면 검색하게 해주는 식은
작성이 가능할까요?
감사합니다
2025-06-19
231
글번호 191923
답변완료
부탁드립니다
아래수식을 검색식으로 만들어 주시면 감사하겠습니다.
A=Predayhigh()-Predaylow();
B=Dayopen()+a*0.5;
B1=RSI(2);
Crossup(C,B) and B1>50
2025-06-19
301
글번호 191922
답변완료
문의
국내주간선물 5분봉 기준입니다.
아래수식은 수량 1개로 운영하는 수식입니다.
요청사항)
첫진입때 수량 2개를 진입시키고
1개씩 청산수식을 따로 적용하여 청산하고 싶습니다.
첫번째 청산수식(2개에서 1개)
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop);
두번째 청산수식(나머지 1개)
SetStopLoss(2,PointStop);
SetStopTrailing(3,0,PointStop);
수식 완성 부탁드립니다.
항상 고맙습니다.
*****************************************************************************
input : upfs(575);
var : T1(0),entry(0);
if Bdate != Bdate[1] Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if data1(Bdate)==data2(Bdate) and Data2(c>Lowd(0)+upfs) and entry==0 Then
Buy("b");
SetStopLoss(1,PointStop);
SetStopTrailing(2,0,PointStop);
2025-06-19
241
글번호 191921
답변완료
분봉9분봉에서 지금분봉이 최고값으로 변환 부탁드려요 항상 감사하고 있슴미다
실력이 안되서 정말 죄송함미다 건강하세요
분봉 9 분봉에서 지금 9 분봉이 41봉 최고 높은값이 나올때 종목검색 할수 있게 수정부탁 드려요
항상 감사하고 있슴미다 건강하세요
input : AvgLen(7);
var : xclose(0),xopen(0),xvolume(0),nVolAccum(0),nRes(0);
PlotBaseLine1(0,"line",red);
xClose = close;
xOpen = open;
xVolume = volume;
nVolAccum = AccumN(iff(xClose > xOpen, xVolume, iff(xClose < xOpen, -xVolume, 0)) ,AvgLen);
nRes = nVolAccum / AvgLen;
2025-06-19
234
글번호 191920