커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3472
글번호 230811
답변완료
변환 부탁드립니다.
적용가능하도록 부탁드립니다.
-------------아래부터 복사하세요-------------
//@version=6
indicator('TVM CCI', overlay = false, precision = 2)
// ───── Input Parameters ─────
length_low = input.int(72, "Slow CCI Length")
length_high = input.int(36, "Fast CCI Length")
refit_interval = input.int(50, "Volatility Refit Interval")
vol_period = input.int(20, "Current Volatility Period")
vol_smooth_len = input.int(5, "Volatility Smoothing Length")
bull_col = input.color(color.green, title="Bullish Color")
bear_col = input.color(color.red, title="Bearish Color")
// ───── CCI-based Oscillator with Clipping ─────
cci_oscillator(src, length) =>
raw = ta.cci(src, length)
clipped = math.max(math.min(raw, 100), -100)
normalized = clipped / 200 + 0.5
normalized
// ───── Volatility Calculations ─────
returns = close / close[1] - 1
vol_current_raw = ta.stdev(returns, vol_period)
vol_current_smoothed = ta.sma(vol_current_raw, vol_smooth_len)
// ───── Volatility History Management ─────
var array<float> vola = array.new<float>()
if not na(vol_current_raw)
array.push(vola, vol_current_raw)
if array.size(vola) > 150
array.shift(vola)
// ───── Volatility Clustering ─────
cluster(arr) =>
if array.size(arr) < 10
[na, na]
else
median = array.median(arr)
sum_low = 0.0
count_low = 0
sum_high = 0.0
count_high = 0
for i = 0 to array.size(arr) - 1
val = array.get(arr, i)
if val < median
sum_low += val
count_low += 1
else
sum_high += val
count_high += 1
low_avg = count_low > 0 ? sum_low / count_low : na
high_avg = count_high > 0 ? sum_high / count_high : na
[low_avg, high_avg]
// ───── Volatility Regime Variables (with type) ─────
var float cluster_1 = na
var float cluster_2 = na
var float last_refit_bar = na
var int vol_regime = na
if bar_index - last_refit_bar >= refit_interval and array.size(vola) >= 150
[c1, c2] = cluster(vola)
if not na(c1) and not na(c2)
cluster_1 := na(cluster_1) ? c1 : cluster_1 + 0.1 * (c1 - cluster_1)
cluster_2 := na(cluster_2) ? c2 : cluster_2 + 0.1 * (c2 - cluster_2)
last_refit_bar := bar_index
if cluster_1 > cluster_2
temp = cluster_1
cluster_1 := cluster_2
cluster_2 := temp
if not na(vol_current_smoothed) and not na(cluster_1) and not na(cluster_2)
mid = (cluster_1 + cluster_2) / 2
vol_regime := vol_current_smoothed < mid ? 0 : 1
// ───── Oscillator S e l e c t i o n ─────
osc_low = cci_oscillator(close, length_low)
osc_high = cci_oscillator(close, length_high)
relevant_osc = vol_regime == 1 ? osc_high : osc_low
// ───── Trend Regime Detection ─────
var int trend_regime = na
trend_regime := relevant_osc > 0.75 ? 1 : relevant_osc < 0.25 ? -1 : 0
// ───── Plots ─────
hline(0.5, "Mid", color=color.gray, linestyle=hline.style_dashed)
zero = plot(-0.2, display=display.none)
top = plot(1.2, display=display.none)
plot_osc_low = plot(osc_low, title="Slow CCI", color=osc_low >= 0.5 ? bull_col : bear_col, linewidth=1)
plot_osc_high = plot(osc_high, title="Fast CCI", color=osc_high >= 0.5 ? bull_col : bear_col, linewidth=1)
fill(plot_osc_low, plot_osc_high, color=osc_low >= 0.5 ? color.new(bull_col, 85) : color.new(bear_col, 85))
bullish_shift = trend_regime == 1 and trend_regime[1] != 1
bearish_shift = trend_regime == -1 and trend_regime[1] != -1
plotshape(bullish_shift ? 1.2 : na, title="Bullish Shift", location=location.absolute, color=color.new(bull_col, 0), style=shape.triangleup, size=size.tiny, offset=-1)
plotshape(bearish_shift ? -0.2 : na, title="Bearish Shift", location=location.absolute, color=color.new(bear_col, 0), style=shape.triangledown, size=size.tiny, offset=-1)
bg = trend_regime == 1 ? color.new(bull_col, 90) : trend_regime == -1 ? color.new(bear_col, 90) : na
fill(top, zero, color=bg)
// ───── Trend Table ─────
var table regimeTable = table.new(position.top_right, 1, 1)
if barstate.islast
txt = trend_regime == 1 ? "semi-line" : trend_regime == -1 ? "semi-line" : "Neutral"
bgc = trend_regime == 1 ? color.new(bull_col, 20) : trend_regime == -1 ? color.new(bear_col, 20) : color.new(color.gray, 20)
table.cell(regimeTable, 0, 0, txt, bgcolor=bgc, text_color=color.white, text_size=size.small)
2025-07-02
410
글번호 192240
답변완료
93403 재문의
안녕하세요?
스윙하이들 또는 스윙로우들이 너무 따닥따닥 붙어서 발생하는 것은 무시하기 위해서
input: n(10)봉 이상의 간격을 두고 스윙들이 발생하는 것만 인정하고 싶은데,
이 부분은 아직 수식에 반영되지 않은 것 같습니다.
감사합니다.
2025-07-02
240
글번호 192239
답변완료
검색식 부탁 드려요
어제보다 상승한 종목(일봉) 검색식 부탁드려요.
2025-07-02
261
글번호 192238
답변완료
체결강도 갭보정 수식
수고가 많으십니다
아침 장개시 할때 아래의 수식(체결강도) 갭보정 수식 부탁드립니다.
input : P1(5),p2(20),p3(60);
var : mav1(0),mav2(0),mav3(0);
var1 = AccumN(Upvol,DayIndex+1)/accumn(downvol,DayIndex+1)*100;
mav1 = ma(var1,p1);
mav2 = ma(var1,p2);
mav3 = ma(var1,p3);
Plot1(mav1,"이평1",IFf(mav1>mav1[1],Magenta,Lime));
Plot2(mav2,"이평2",IFf(mav2>mav2[1],Red,Blue));
Plot3(mav3,"이평3",IFf(mav3>mav3[1],Red,Blue));
PlotBaseLine2(100, "기준선");
PlotBaseLine1(105, "기준선105");
PlotBaseLine3(95, "기준선95");
수고하세요.
2025-07-02
302
글번호 192237
답변완료
문의드립니다.
아래의 트레이딩뷰 수식을 변경 부탁드립니다.
===================
indicator(shorttitle="[-_-] VCATR", title="[-_-] Volatility Calibrated ATR", overlay=true)
src = input.source(close, "Source")
atr_factor = input.float(5.0, "ATR Factor", minval=0.25, step=0.25)
// For standard deviation
d = 20
n = 20
// Volatility function
vol_f() =>
x = math.exp(ta.stdev(math.log(close / close[1]), n) * d)
y = src * math.pow(x, 2)
z = src / math.pow(x, 2)
ta.stoch(close, y, z, n)
// ATR
atr_f(length) =>
sum = 0.0
tr = math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))
sum := (tr + (length - 1) * nz(sum[1])) / length
sum
// Calibrator function
main_f(source, atr_factor) =>
var bool uptrend = true
var float max = src
var float min = src
var float stop = 0.0
vol = vol_f()
len = math.max(1, math.min(2000, math.abs(int(106 * (na(vol) ? 1 : vol / 100)))))
atr = atr_f(len)
atrM = ta.wma(atr, len) * atr_factor - ta.stdev(atr, len)
max := math.max(max, src)
min := math.min(min, src)
stop := nz(uptrend ? math.max(stop, max - atrM) : math.min(stop, min + atrM), src)
uptrend := src - stop >= 0.0
if uptrend != nz(uptrend[1], true)
max := src
min := src
stop := uptrend ? max - atrM : min + atrM
[stop, uptrend]
// Request Heikin Ashi data
[stop, uptrend] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, main_f(src, atr_factor))
// Conditions
down = uptrend != uptrend[1] and not uptrend
up = uptrend != uptrend[1] and uptrend
// Drawings
plotshape(down, style=shape.square, color=color.red, size=size.tiny, title="Downtrend begins")
plotshape(up, style=shape.square, color=color.green, size=size.tiny, location=location.belowbar, title="Uptrend begins")
plot(stop, color=uptrend ? color.new(color.green, 50) : color.new(color.red, 50), linewidth=2, title="Volatility Calibrated ATR")
====================
항상 감사드립니다. 수고하세요!!!
2025-07-02
386
글번호 192232
답변완료
부탁합니다.
입력값은 기간 : 5 , 중심 : ma(C,10)
수식은
M=eavg(C,기간);
if(중심 <M , M, 중심);
1.지표수식으로
2.종목검색식으로 종가가 위의 수식 상향 돌파시 검색할 수 있도록 부탁드립니다.
2025-07-02
278
글번호 192231
답변완료
문의 드립니다.
아래식에서 20이평을 기준으로 하고자 합니다.
20이평 위이면 매수 적용
20이평 아래면 매도 적용
부탁드립니다.
if c > o Then
Buy();
if c < o Then
ExitLong();
if c < o Then
Sell();
if c > o Then
ExitShort();
2025-07-02
255
글번호 192226
답변완료
문의드립니다
안녕하세요?
현재발생하는 신호위치에서 1봉이전에 발생하도록 부탁드립니다
감사합니다
input : length(15);
input : show_levl(true);
var : up(0),dn(0),A(0),emaValue(0),correction(0),zlma(0);
var : signalUp(False),signalDn(False),zlma_color(0),ema_col(0);
var : TOP(0),BTM(0),box(0),tx(0),tx1(0),check_signals(False);
up = Green;
dn = Blue;
#var box1 = box(na) // Variable to store the box
a = atr(200);
emaValue = ema(close, length);
correction = close + (close - emaValue);
zlma = ema(correction, length);
signalUp = CrossUp(zlma, emaValue);
signalDn = CrossDown(zlma, emaValue);
zlma_color = iff(zlma > zlma[3] , up , iff(zlma < zlma[3] , dn , Nan));
ema_col = iff(emaValue < zlma , up , dn);
//plot1(zlma, "ZLMA",zlma_color); // Plot ZLMA
///
if signalUp Then
{
Top = zlma;
BTM = zlma-A;
// box = box_new(sDate,sTime,Top,NextBarSdate,NextBarStime,BTM);
//Box_SetColor(box,up);
//Box_SetFill(box,true);
var3 = (Top+BTM)/2;
// tx = Text_New(NextBarSdate,NextBarStime,var3,NumToStr(C,2));
Text_SetStyle(tx,1,2);
}
else if signalDn Then
{
Top = zlma+A;
BTM = zlma;
// box = box_new(sDate,sTime,Top,NextBarSdate,NextBarStime,BTM);
// Box_SetColor(box,dn);
//Box_SetFill(box,true);
var3 = (Top+BTM)/2;
// tx = Text_New(NextBarSdate,NextBarStime,var3,NumToStr(C,2));
Text_SetStyle(tx,1,2);
}
Else
{
// Box_SetEnd(box,sDate,sTime,BTM);
// Text_SetLocation(tx,sDate,sTime,var3);
}
check_signals = signalUp or signalDn;
if CrossUp(low, Top) and emaValue < zlma Then
buy();
if CrossDown(high, BTM) and emaValue > zlma Then
Sell();
2025-07-02
281
글번호 192223
답변완료
지표수식값
안녕 하십닌까 ..
macd 수식을 키움과 예스트레이더에 아래 수식값을 넣으려 하는데
어떻게 변경하면 될까요
macd + 200ema
//@version=5
indicator(title=macd+200ema",timeframe="",timeframe_gaps=true)
// getting inputs
fast_length = input(title = "fast length", defval =12)
slow_length = input(title = "slow length", defval =26)
src = input(title = "source" , defval =close)
signal_length = input.int(title ="signal smoothing",minval=1,maxval=50,
defval = 9 , display = display.data_windows)
sma_source = input.string(title=:oscillator ma type",defval= "ema", options =
[ "sma", "ema"],display = display.data_windows)
sma_signal=input.string(title = "signal line ma type",defval = "ema",
option=[ "sma", "ema"],display = display.data_windows)
// calculating
2025-07-02
282
글번호 192222