커뮤니티
예스랭귀지 Q&A
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1316
글번호 230811
답변완료
문의드립니다.
늘 노고에 감사드립니다.
[청산 기본조건] 진입가 대비 100틱 이상 상승 (종가가 아니라 고가기준)
청산 기본조건을 만족했다는 전제로 30봉 이내에 RSI가 30 이상 하락하면 청산하는 청산식을 원합니다.
매도는 그 반대입니다.
감사합니다.
2025-05-25
260
글번호 191141
답변완료
질문 부탁드립니다
주말 잘 보내셨길 바랍니다
text 관련 질문 하나 드려요
새로운 조건이 나왔을때는 0으로 표시하고
그 전은 1 (txtt1[1] 에는 1), 전전은 2 ... 이런식으로 text 표시를 하려고
아래 수식 for 문에
Text_SetString(txtt1[cnt],NumToStr(cnt,0));
넣었는데요 다 0 으로 나오게 되네요
어디서 작성이 잘못 된건지 한 번 봐주셨으면 합니다
감사합니다
var : cnt(0), sum1(0), sumi1(0),summ(0),tt(0),hh(0),ll(0),tl(0),tl1(0),n(0),ae(0);
var: sum2(0),sumi2(0),count(0),sumaa(0),sumai(0),avgaa(0);
var : t(0),StartBarIndex(0),dd(0),d1(0),d2(0),e1(0),e2(0);
Array : ii[50](0),aa[50](0),cc[50](0),ee[50](0),ttl[30](0),txtt[40](0),txtt1[40](0),
tttl1[40](0),tttl2[40](0),sd[45](0),st[45](0),ad[50](0),at[50](0);
if Bdate != Bdate[1] Then
{
DD = DD+1;
}
if (h>l*1.08) and (d1 == 0 or (d1 > 0 and dd >= d1+5)) Then
{
d1 = dd;
hh = h;
var1 = Index;
Var2 = var1[1];
Var3 = Var2[1];
sum1=0; sumi1=0; sum2=0; sumi2=0;
For cnt = 1 to (var1-Var2)
{
sum1=sum1+l[cnt];
sumi1=sumi1+1;
}
value1=sum1/sumi1;
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
sd[cnt] =sd[cnt-1];
st[cnt] =st[cnt-1];
txtt[cnt] = txtt[cnt-1];
tttl1[cnt]=tttl1[cnt-1];
Text_SetString(txtt1[cnt],NumToStr(cnt,0));
}
aa[0] = value1;
sd[0] = sDate;
st[0] = sTime;
txtt1[0]=text_new(sd[0],st[0],aa[0],numToStr(0,0));
TL_SetExtRight( tttl1[6],False);
tttl1[0] = TL_New(sd[7],st[7],aa[7],sd[3],st[3],aa[3]);
TL_SetDrawMode( tttl1[0],0);
TL_Delete( tttl1[6]);
TL_SetExtRight( tttl1[0],true);
}
2025-05-26
284
글번호 191140
답변완료
종목 검색 부탁드립니다.
1. 후행스팬이 (일목균형표9 26 52) 볼린저 밴드(20,2) 상한선을 돌파 할때
종목 검색식 부탁 드립니다.
2. 전봉대비 (전일대비) 현재봉이 5% 이상 상승한 종목 검색식 부탁합니다.
2025-05-24
283
글번호 191139
답변완료
부틱드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © Zeiierman {
//@version=6
indicator('Trend Speed Analyzer (Zeiierman)', overlay = false)
//~~}
// ~~ Tooltips {
string t1 = 'Maximum Length: This parameter sets the upper limit for the number of bars considered in the dynamic moving average. A higher value smooths out the trend line, making it less reactive to minor fluctuations but slower to adapt to sudden price movements. Use higher values for long-term trend analysis and lower values for faster-moving markets.'
string t2 = 'Accelerator Multiplier: Adjusts the responsiveness of the dynamic moving average to price changes. A larger value makes the trend more reactive but can introduce noise in choppy markets. Lower values create a smoother trend but may lag behind rapid price movements. This is particularly useful in volatile markets where precise sensitivity is needed.'
string t5 = 'Enable Candles: When enabled, the candlesticks on the chart will be color-coded based on the calculated trend speed. This provides a visual representation of momentum, making it easier to spot shifts in market dynamics. Disable this if you prefer the standard candlestick colors.'
string t6 = 'Collection Period: Defines the number of bars used to normalize trend speed values. A higher value includes a broader historical range, smoothing out the speed calculation. Lower values make the speed analysis more sensitive to recent price changes, ideal for short-term trading.'
string t7 = 'Enable Table: Activates a statistical table that provides an overview of key metrics, such as average wave height, maximum wave height, dominance, and wave ratios. Useful for traders who want numerical insights to complement visual trend analysis.'
string t8 = 'Lookback Period: Determines how many historical bars are used for calculating bullish and bearish wave data. A longer lookback period provides a more comprehensive view of market trends but may dilute sensitivity to recent market conditions. Shorter periods focus on recent data.'
string t9 = 'Start Date: Sets the starting point for all calculations. This allows you to analyze data only from a specific date onward, which is useful for isolating trends within a certain period or avoiding historical noise.'
string t10 = 'Timer Option: S elect between using a custom start date or starting from the first available bar on the chart. The ₩'Custom₩' option works with the Start Date setting, while ₩'From start₩' includes all available data.'
// Tooltips for Table Cells
string tt1 = 'Average Wave: Shows the average size of bullish or bearish waves during the lookback period. Use this to assess overall market strength. Larger values indicate stronger trends, and comparing bullish vs bearish averages can reveal market bias. For instance, a higher bullish average suggests a stronger uptrend.'
string tt2 = 'Max Wave: Displays the largest bullish or bearish wave during the lookback period. Use this to identify peak market momentum. A significantly higher bullish or bearish max wave indicates where the market may have shown extreme trend strength in that direction.'
string tt3 = 'Current Wave Ratio (Average): Compares the current wave₩'s size to the average wave size for both bullish and bearish trends. A value above 1 indicates the current wave is stronger than the historical average, which may signal increased market momentum. Use this to evaluate if the current move is significant compared to past trends.'
string tt4 = 'Current Wave Ratio (Max): Compares the current wave₩'s size to the maximum wave size for both bullish and bearish trends. A value above 1 suggests the current wave is setting new highs in strength, which could indicate a breakout or strong momentum in the trend direction.'
string tt5 = 'Dominance (Average): The net difference between the average bullish and bearish wave sizes. Positive values suggest bullish dominance over time, while negative values indicate bearish dominance. Use this to determine which side (bulls or bears) has had consistent control of the market over the lookback period.'
string tt6 = 'Dominance (Max): The net difference between the largest bullish and bearish wave sizes. Positive values suggest bulls have dominated with stronger individual waves, while negative values indicate bears have produced stronger waves. Use this to gauge the most significant power shifts in the market.'
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
max_length = input.int(50, minval = 1, title = 'Maximum Length', group = 'Dynamic Moving Average', tooltip = t1)
accel_multiplier = input.float(5.0, minval = 0.0, step = 1.1, title = 'Accelerator Multiplier', group = 'Dynamic Moving Average', tooltip = t2)
tbl_ = input.bool(true, title = 'Enable Table', group = 'Wave Analysis', tooltip = t7)
lookback_period = input.int(100, minval = 1, step = 1, title = 'Lookback Period', group = 'Wave Analysis', tooltip = t8)
candle = input.bool(true, title = 'Enable Candles', group = 'Trend Visualization', tooltip = t5)
collen = input.int(100, step = 10, minval = 5, title = 'Collection Period', group = 'Trend Visualization', tooltip = t6)
up_col = input.color(color.lime, title = 'Dynamic Trend', group = 'Trend Visualization', inline = 'Trend')
dn_col = input.color(color.red, title = '', group = 'Trend Visualization', inline = 'Trend')
up_hist_col = input.color(#82ffc3, title = 'Trend Speed Up', group = 'Trend Visualization', inline = 'up')
up_hist_col_ = input.color(color.lime, title = '', group = 'Trend Visualization', inline = 'up')
dn_hist_col = input.color(color.red, title = 'Trend Speed Dn', group = 'Trend Visualization', inline = 'dn')
dn_hist_col_ = input.color(#f78c8c, title = '', group = 'Trend Visualization', inline = 'dn')
start = input.time(timestamp('1 Jan 2020 00:00 +0000'), title = 'Start Date', group = 'Time Settings', tooltip = t9, inline = 'startdate')
timer = input.string('From start', title = 'Timer Option', options = ['Custom', 'From start'], group = 'Time Settings', tooltip = t10, inline = 'startdate')
// ~~ Dynamic Average {
counts_diff = close
max_abs_counts_diff = ta.highest(math.abs(counts_diff), 200)
counts_diff_norm = (counts_diff + max_abs_counts_diff) / (2 * max_abs_counts_diff)
dyn_length = 5 + counts_diff_norm * (max_length - 5)
// ~~ Function to compute the accelerator factor with normalization of delta_counts_diff {
// Parameters:
// - counts_diff (float): Difference between bullish and bearish counts
// - prev_counts_diff (float): Previous value of counts_diff
// Returns: Accelerator factor (float)
calc_accel_factor(float counts_diff, float prev_counts_diff) =>
// Compute the change in counts_diff
delta_counts_diff = math.abs(counts_diff - prev_counts_diff)
// Normalize delta_counts_diff over last 200 bars
float max_delta_counts_diff = ta.highest(delta_counts_diff, 200)
max_delta_counts_diff := max_delta_counts_diff == 0 ? 1 : max_delta_counts_diff
// Compute accelerator factor
float accel_factor = delta_counts_diff / max_delta_counts_diff
// Return accelerator factor
accel_factor
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Function to adjust alpha using the accelerator factor {
// Parameters:
// - dyn_length (float): The dynamic length for the moving average
// - accel_factor (float): The accelerator factor to adjust smoothing
// - accel_multiplier (float): Multiplier to control the strength of the acceleration
// Returns: Adjusted alpha (float)
adjust_alpha(float dyn_length, float accel_factor, float accel_multiplier) =>
// Adjust alpha with accelerator factor
alpha_base = 2 / (dyn_length + 1)
alpha = alpha_base * (1 + accel_factor * accel_multiplier)
alpha := math.min(1, alpha) // Ensure alpha does not exceed 1
// Return the adjusted alpha
alpha
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Accelerator Factor
accel_factor = calc_accel_factor(counts_diff, nz(counts_diff[1]))
alpha = adjust_alpha(dyn_length, accel_factor, accel_multiplier)
// ~~ Compute dynamic Ema
var float dyn_ema = na
dyn_ema := na(dyn_ema[1]) ? close : alpha * close + (1 - alpha) * dyn_ema[1]
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Trend Speed {
trend = dyn_ema
bullsrc = close
bearsrc = close
type TrendData
array<float> change
array<int> t
StartTime() =>
time > start
var bullish = TrendData.new(array.new<float>(), array.new<int>())
var bearish = TrendData.new(array.new<float>(), array.new<int>())
var x1 = int(na)
var y1 = float(na)
var pos = 0
var speed = 0.0
c = ta.rma(close, 10)
o = ta.rma(open, 10)
// ~~ First value {
if na(x1) and StartTime() or na(x1) and timer == 'From start'
x1 := bar_index
y1 := o
y1
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Trend direction {
if StartTime() or timer == 'From start'
if bullsrc > trend and bullsrc[1] <= trend
bearish.change.unshift(ta.lowest(speed, bar_index - x1))
bearish.t.unshift(bar_index - x1)
x1 := bar_index
y1 := bullsrc
pos := 1
speed := c - o
speed
if bearsrc < trend and bearsrc[1] >= trend
bullish.change.unshift(ta.highest(speed, bar_index - x1))
bullish.t.unshift(bar_index - x1)
x1 := bar_index
y1 := bearsrc
pos := -1
speed := c - o
speed
speed := speed + c - o
speedGradient = color.from_gradient(speed, ta.min(-speed / 3), ta.max(speed / 3), color.red, color.lime)
trendspeed = ta.hma(speed, 5)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Plots {
// ~~ Trend Plot {
rma_dyn_ema(x, p) =>
average = ta.rma(dyn_ema[x], p)
average
colour = ta.wma(close, 2) > dyn_ema ? up_col : dn_col
fillColor = rma_dyn_ema(0, 5) > rma_dyn_ema(1, 5) ? color.new(up_col, 70) : color.new(dn_col, 70)
p1 = plot(dyn_ema, color = colour, linewidth = 2, title = 'Dynamic Trend', force_overlay = true)
p2 = plot(ta.rma(hl2, 50), display = display.none, editable = false, force_overlay = true)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
min_speed = ta.lowest(speed, collen)
max_speed = ta.highest(speed, collen)
normalized_speed = (speed - min_speed) / (max_speed - min_speed)
speedGradient1 = speed < 0 ? color.from_gradient(normalized_speed, 0.0, 0.5, dn_hist_col, dn_hist_col_) : color.from_gradient(normalized_speed, 0.5, 1.0, up_hist_col, up_hist_col_)
plot(StartTime() or timer == 'From start' ? trendspeed : na, title = 'Trend Speed', color = speedGradient1, style = plot.style_columns)
plotcandle(open, high, low, close, color = candle ? speedGradient1 : na, wickcolor = candle ? speedGradient1 : na, bordercolor = candle ? speedGradient1 : na, force_overlay = true)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Table {
if barstate.islast and tbl_
// Calculate recent bullish and bearish changes
bullish_recent = bullish.change.slice(0, math.min(lookback_period, bullish.change.size()))
bearish_recent = bearish.change.slice(0, math.min(lookback_period, bearish.change.size()))
// Calculate stats
bull_max = bullish_recent.max()
bear_max = bearish_recent.min()
bull_avg = bullish_recent.avg()
bear_avg = bearish_recent.avg()
// Calculate wave size ratios for max and average wave heights
wave_size_ratio_avg = bull_avg / math.abs(bear_avg)
wave_size_text_avg = str.tostring(math.round(wave_size_ratio_avg, 2)) + 'x'
wave_size_color_avg = wave_size_ratio_avg > 0 ? color.lime : color.red
wave_size_ratio_max = bull_max / math.abs(bear_max)
wave_size_text_max = str.tostring(math.round(wave_size_ratio_max, 2)) + 'x'
wave_size_color_max = wave_size_ratio_max > 0 ? color.lime : color.red
// Dominance calculation
dominance_avg_value = bull_avg - math.abs(bear_avg)
dominance_avg_text = dominance_avg_value > 0 ? 'Bullish +' + str.tostring(math.round(wave_size_ratio_avg, 2))
+ 'x' : 'Bearish -' + str.tostring(math.round(1 / wave_size_ratio_avg, 2)) + 'x'
dominance_avg_color = dominance_avg_value > 0 ? color.lime : color.red
dominance_max_value = bull_max - math.abs(bear_max)
dominance_max_text = dominance_max_value > 0 ? 'Bullish +' + str.tostring(math.round(wave_size_ratio_max, 2))
+ 'x' : 'Bearish -' + str.tostring(math.round(1 / wave_size_ratio_max, 2)) + 'x'
dominance_max_color = dominance_max_value > 0 ? color.lime : color.red
// Current wave calculations
current_wave = speed
current_wave_color = current_wave > 0 ? color.lime : color.red
current_ratio_avg = current_wave > 0 ? current_wave / bull_avg : current_wave / math.abs(bear_avg)
current_ratio_max = current_wave > 0 ? current_wave / bull_max : current_wave / math.abs(bear_max)
current_text_avg = str.tostring(math.round(current_ratio_avg, 2)) + 'x'
current_text_max = str.tostring(math.round(current_ratio_max, 2)) + 'x'
current_color_avg = current_ratio_avg > 0 ? color.lime : color.red
current_color_max = current_ratio_max > 0 ? color.lime : color.red
// Table
var tbl = table.new(position.top_right, 3, 3, force_overlay = true)
// Header Row
table.cell(tbl, 0, 0, '', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 0, 1, 'Average Wave', text_color = chart.fg_color, tooltip = tt1)
table.cell(tbl, 0, 2, 'Max Wave', text_color = chart.fg_color, tooltip = tt2)
// Current Wave Ratio Row
table.cell(tbl, 1, 0, 'Current Wave Ratio', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 1, 1, current_text_avg, text_color = current_color_avg, tooltip = tt3)
table.cell(tbl, 1, 2, current_text_max, text_color = current_color_max, tooltip = tt4)
// Dominance Row
table.cell(tbl, 2, 0, 'Dominance', text_color = chart.fg_color, tooltip = '')
table.cell(tbl, 2, 1, dominance_avg_text, text_color = dominance_avg_color, tooltip = tt5)
table.cell(tbl, 2, 2, dominance_max_text, text_color = dominance_max_color, tooltip = tt6)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
2025-05-24
737
글번호 191138
답변완료
문의 드립니다.
당일 중심선과 20이평을 활용하고자 합니다.
중심선 위에 주가가 있고 20이평선을 아래서 위로 돌파 시 매수
매수 후 20이평을 아래로 깨면 매도 청산 완료
중심선 아래에 주가가 있고 20이평선 위에서 아래로 이탈 시 매도
매도 후 20이평을 위로 돌파하면 매수 청산 완료
부탁드립니다.
2025-05-24
238
글번호 191137
우유 님에 의해서 삭제되었습니다.
2025-05-26
56
글번호 191136
답변완료
부탁합니다
키움수식입니다
부탁드리겠습니다
하나
B1=if(eavg(C,5)-eavg(C,12) > eavg(eavg(C,5)-eavg(C,12),9), 1,-1);
B2=if(C > avg(C, 7), 1, -1);
B3=if((C - C(5)) / C(5) * 33 > 0, 1, -1);
B4=if(eavg((C-lowest(L, 5)) / (highest(H, 5) - lowest(L, 5)) * 33, 3)>50, 1, -1);
B5=If(CCI(20) > 0,1,-1);
B6=If(C > SAR(0.02,0.2),1,-1);
B7=If((eavg(sum(((C -L)-(H- C))/ (H-L)*V), 3)-eavg(sum(((C -L)-(H- C))/(H-L)*V), 10))>0,1,-1);
D=B1+B2+B3+B4+B5+B6+B7;
D1=eavg(D,3);
A=RSI(9)-25;
A1=CMO(3)*0.5;
A2=A+A1;
(Crossup(D,-25) or ((A(1) and A1(1))>A2(1))) AND
D1<=-5 AND A2>A2(1) AND D1>D1(1)
----------------------------------------------
둘
Period: 20
D1: 2
Bollinger Bands 하한선 하향돌파 검색종목
Bollinger Bands 하한선 상샹돌파 검색종목
도 부탁합니다
2025-05-25
328
글번호 191135
답변완료
수식요청 부탁드립니다
A1 = if(c>o,V,0);
A2 = sum(A1);
A3 = ValueWhen(1,date!=date(1),A2(1));
매수 = A2-A3;
B1 = if(c<o,V,0);
B2 = sum(B1);
B3 = ValueWhen(1,date!=date(1),B2(1));
매도 = B2-B3;
분봉체결강도=매수/매도*100;
분봉체결강도 > 100
항상 감사드립니다
2025-05-23
296
글번호 191134
답변완료
지표식작성부탁드립니다
사용지표 ; 20이평, 일목 구름층
지표조건 : 20이평이 구름층 위에 있으면 차트바탕이 노란색으로
표시되는 지표식 부탁합니다
2025-05-23
273
글번호 191133