커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1523
글번호 230811
답변완료
신호수식 부탁드립니다.
항상 감사드립니다. 신호수식 부탁드립니다.
a1=HuLL(c, 60);
a2=HuLL(c, 10);
D=요일(date);
WC=Valuewhen(1, D<D(1), C(1));
WO=Valuewhen(2, D<D(1), O);
b1=(WC+WO)/2;
Y=floor(date/10000);
YC=Valuewhen(1, Y!=Y(1), C(1));
YO=Valuewhen(2, Y!=Y(1), O);
YL=Valuewhen(1, Y!=Y(1), C(1));
Yh=Valuewhen(1, Y!=Y(1), h(1));
M=floor(date/100);
MC=Valuewhen(1, M!=M(1), C(1));
MO=Valuewhen(2, M!=M(1), O);
ML=Valuewhen(1, M!=M(1), L(1));
Mh=Valuewhen(1, M!=M(1), h(1));
D=요일(date);
WC=Valuewhen(1, D<D(1), C(1));
WO=Valuewhen(2, D<D(1), O);
WL=Valuewhen(1, D<D(1), L(1));
Wh=Valuewhen(1, D<D(1), h(1));
b2=(YL+ML+WL)/3;
b3=(Yc+Mc+Wc)/3;
b4=(Yh+Mh+Wh)/3;
D1=ma(c, 10,가중);
D2=ma(c, 60, 단순);
(c>a1 && o<=a1 && c>a2 && o<=a2 &&
c>b1 && o<=b1 && c>b2 && o<=b2 &&
c>b3 && o<=b3 && c>b4 && o<=b4 &&
((c>d1 && o<=d1) or (c>d2 && o<=d2))) or
(c>a1 && c>a2 && c>b1 && c>b2 && c>b3 && c>b4 && c>o &&
L(1)<=a1(1) && L(1)<=a2(1) && L(1)<=b1(1) && L(1)<=b2(1) &&
L(1)<=b3(1) && L(1)<=b4(1) && c(1)>o(1))
2025-09-18
224
글번호 194101
답변완료
부틱드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
//@version=4
study(title="RSI Trends")
len = input(14, title="RSI Length")
ob = input(60, title="Upper Threshold")
os = input(40, title="Lower Threshold")
barcolor = input(true, title="Colored Bars")
rsi = rsi(close, len)
plot(rsi, color=color.gray)
col1 = rsi >= ob ? color.green : na
col2 = rsi <= os ? color.red : na
col0 = rsi < ob and rsi > os ? color.gray : na
plot1 = plot(rsi, style=plot.style_linebr, linewidth=3, color=col1)
plot2 = plot(rsi, style=plot.style_linebr, linewidth=3, color=col2)
barcolor(barcolor ? col1 : na)
barcolor(barcolor ? col2 : na)
barcolor(barcolor ? col0 : na)
h1 = hline(ob)
h2 = hline(os)
2025-09-18
260
글번호 194100
답변완료
수식 문의 드립니다
안녕하십니까?
FORCE INDEX(5,20)의 FVALFAST가
이전봉 10개중 최고점을 상향 통과 하는 종목
의 검색식을 부탁드립니다.
2025-09-17
239
글번호 194099
답변완료
부탁드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
// === INPUTS ===
useRes = input(defval = true, title = "Use Alternate Resolution?")
intRes = input(defval = 3, title = "Multiplier for Alernate Resolution")
stratRes = ismonthly? tostring(interval*intRes,"###M") : isweekly? tostring(interval*intRes,"###W") : isdaily? tostring(interval*intRes,"###D") : isintraday ? tostring(interval*intRes,"####") : '60'
//
basisType = input(defval = "SMMA", title = "MA Type: ", options=["SMA", "EMA", "DEMA", "TEMA", "WMA", "VWMA", "SMMA", "HullMA", "LSMA", "ALMA", "SSMA", "TMA"])
basisLen = input(defval = 8, title = "MA Period", minval = 1)
offsetSigma = input(defval = 6, title = "Offset for LSMA / Sigma for ALMA", minval = 0)
offsetALMA = input(defval = 0.85, title = "Offset for ALMA", minval = 0, step = 0.01)
delayOffset = input(defval = 0, title = "Delay Open/Close MA (Forces Non-Repainting)", minval = 0, step = 1)
//
uDiv = input(false,"Show Divergence Channel")
multi = input(0.5,minval=0.0,maxval=3.0,title="Divergence Channel Width Factor (Stddev)")
uHid = input(false, title="Show Hidden Divergence")
uReg = input(false, title="Show Regular Divergence")
uDiv := uReg or uHid ? uDiv : false
// === /INPUTS ===
// - variant(type, src, len)
// Returns MA input s e lection variant, default to SMA if blank or typo.
// Returns MA input s e lection variant, default to SMA if blank or typo.
variant(type, src, len, offSig, offALMA) =>
v1 = sma(src, len) // Simple
v2 = ema(src, len) // Exponential
v3 = 2 * v2 - ema(v2, len) // Double Exponential
v4 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len) // Triple Exponential
v5 = wma(src, len) // Weighted
v6 = vwma(src, len) // Volume Weighted
v7 = 0.0
v7 := na(v7[1]) ? sma(src, len) : (v7[1] * (len - 1) + src) / len // Smoothed
v8 = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) // Hull
v9 = linreg(src, len, offSig) // Least Squares
v10 = alma(src, len, offALMA, offSig) // Arnaud Legoux
v11 = sma(v1,len) // Triangular (extreme smooth)
// SuperSmoother filter
// © 2013 John F. Ehlers
a1 = exp(-1.414*3.14159 / len)
b1 = 2*a1*cos(1.414*3.14159 / len)
c2 = b1
c3 = (-a1)*a1
c1 = 1 - c2 - c3
v12 = 0.0
v12 := c1*(src + nz(src[1])) / 2 + c2*nz(v12[1]) + c3*nz(v12[2])
type=="EMA"?v2 : type=="DEMA"?v3 : type=="TEMA"?v4 : type=="WMA"?v5 : type=="VWMA"?v6 : type=="SMMA"?v7 : type=="HullMA"?v8 : type=="LSMA"?v9 : type=="ALMA"?v10 : type=="TMA"?v11: type=="SSMA"?v12: v1
// security wrapper for repeat calls
reso(exp, use, res) => use ? security(tickerid, res, exp, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on) : exp
// === SERIES SETUP ===
closeSeries = variant(basisType, close[delayOffset], basisLen, offsetSigma, offsetALMA)
openSeries = variant(basisType, open[delayOffset], basisLen, offsetSigma, offsetALMA)
closeOpenAvg = (closeSeries + openSeries) / 2
// === /SERIES ===
// Get Alternate Open/Close Series MAs, if s e lected.
closeSeriesAlt = reso(closeSeries, useRes, stratRes)
openSeriesAlt = reso(openSeries, useRes, stratRes)
//
xlong = crossover(closeSeriesAlt, openSeriesAlt)
xshort = crossunder(closeSeriesAlt, openSeriesAlt)
longCond = xlong // alternative: longCond[1]? false : (xlong or xlong[1]) and close>closeSeriesAlt and close>=open
shortCond = xshort // alternative: shortCond[1]? false : (xshort or xshort[1]) and close<closeSeriesAlt and close<=open
// === /ALERT conditions
// === PLOTTING ===
diff = closeSeriesAlt - openSeriesAlt
pcd = 50000.0*diff/closeOpenAvg
alert = longCond or shortCond
trendColour = closeSeriesAlt > openSeriesAlt ? green : red
hline(0,color=gray,linestyle=dashed)
plot(pcd,title="OCC Difference Factor", color = trendColour, linewidth=1,style=area,transp=80)
plot(pcd,title="OCC Difference Factor", color = trendColour, linewidth=2,style=line,transp=20)
plotshape(alert,title="OCC Alert Plot", color = trendColour,style=shape.circle,location=location.bottom,transp=0,size=size.auto)
// || Functions:
f_top_fractal(_src)=>_src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0]
f_bot_fractal(_src)=>_src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0]
f_fractalize(_src)=>f_top_fractal(_src) ? 1 : f_bot_fractal(_src) ? -1 : 0
// === /BASE FUNCTIONS ===
rsi_high = pcd
rsi_low = pcd
offset_ = multi*stdev(pcd,20)
fractal_top_rsi = f_fractalize(rsi_high) > 0 ? rsi_high[2] : na
fractal_bot_rsi = f_fractalize(rsi_low) < 0 ? rsi_low[2] : na
rsi_high_prev = valuewhen(fractal_top_rsi, rsi_high[2], 1)
rsi_high_price = valuewhen(fractal_top_rsi, high[2], 1)
rsi_low_prev = valuewhen(fractal_bot_rsi, rsi_low[2], 1)
rsi_low_price = valuewhen(fractal_bot_rsi, low[2], 1)
regular_bearish_div = fractal_top_rsi and high[2] > rsi_high_price and rsi_high[2] < rsi_high_prev and rsi_high>0
hidden_bearish_div = fractal_top_rsi and high[2] < rsi_high_price and rsi_high[2] > rsi_high_prev and rsi_high>0
regular_bullish_div = fractal_bot_rsi and low[2] < rsi_low_price and rsi_low[2] > rsi_low_prev and rsi_low<0
hidden_bullish_div = fractal_bot_rsi and low[2] > rsi_low_price and rsi_low[2] < rsi_low_prev and rsi_low<0
plot(title='RSI High', series=uDiv?rsi_high:na, color=gray)
plot(title='RSI Low', series=uDiv?rsi_low:na, color=gray)
plot(title='RSI H F', series=uDiv?fractal_top_rsi+offset_:na, color=red, offset=-2)
plot(title='RSI L F', series=uDiv?fractal_bot_rsi-offset_:na, color=green, offset=-2)
plot(title='RSI H D', series=uDiv?fractal_top_rsi+offset_:na, style=circles, color=(regular_bearish_div and uReg) or (hidden_bearish_div and uHid)? maroon : gray, linewidth=3, offset=-2)
plot(title='RSI L D', series=uDiv?fractal_bot_rsi-offset_:na, style=circles, color=(regular_bullish_div and uReg) or (hidden_bullish_div and uHid)? green : gray, linewidth=3, offset=-2)
plotshape(title='+RBD', series=regular_bearish_div and uReg? rsi_high[2]+offset_ : na, text='Regular', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='+HBD', series=hidden_bearish_div and uHid? rsi_high[2]+offset_ : na, text='hidden', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='-RBD', series=regular_bullish_div and uReg? rsi_low[2]-offset_ : na, text='Regular', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
plotshape(title='-HBD', series=hidden_bullish_div and uHid? rsi_low[2]-offset_ : na, text='hidden', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
// === ALARM ALERTS for TradingView ALARM sub-system (server based) ===
alertcondition(alert,message="OCC BothCond",title="OCC BothCond")
alertcondition(longCond,message="OCC LongCond",title="OCC LongCond")
alertcondition(shortCond,message="OCC ShortCond",title="OCC ShortCond")
// === /ALARM ALERTS
//eof
2025-09-17
400
글번호 194096
답변완료
안녕하세요. 질문 있습니다.
안녕하세요. 손절 후 쿨다운 기능 구현 관련 질문 입니다.
기존은 조건대로 손절 발생 후 다음 조건대로 계속 진입해서 연속 손절을 하는 문제가 있었습니다. 그래서 조건대로 진입하다가 손절 되면 바로 다음 진입하지 않고 일정 시간 동안 재진입을 막는 쿨다운 기능을 구현하려고 하는데, 제대로 작동하지 않아 문의드립니다.
구현하려는 로직:
손절 발생 시 해당 60분 주기 내에서 설정한 시간(예: 20분) 동안 재진입 차단
60분 주기가 새로 시작되면 쿨다운 리셋하고 처음부터 다시 시작
쿨다운 완료 후 조건 맞으면 재진입, 조건 안 맞으면 다음 60분 주기까지 대기
현재 시도한 코드:
var : InCooldown(0);
var : CooldownStartTF(0);
Input : CooldownMinutes(20);
// 손절 감지 시 쿨다운 시작
if MarketPosition[1] == 1 and MarketPosition == 0 and PositionProfit < 0 Then {
InCooldown = 1;
CooldownStartTF = TF; // 60분 주기 내 시간 저장
TradingAllowed = 0;
}
// 쿨다운 체크
if InCooldown == 1 Then {
if TF >= CooldownStartTF + CooldownMinutes Then {
InCooldown = 0;
TradingAllowed = 1;
} else {
TradingAllowed = 0;
}
}
// 진입 조건에 쿨다운 체크 추가
if TF >= RangeMinutes and TF < 55 and InCooldown == 0 and TradingAllowed == 1 Then {
// 진입 로직
}
문제점:
손절 후 20분이 지나도 해당 60분 주기 내에서 재진입이 안됨
TF 기준으로 쿨다운을 계산했는데 정확히 작동하지 않음
여러 조건에서 TradingAllowed 변수를 동시에 제어할 때 충돌이 발생하는 것 같음
질문사항:
60분 주기 내에서 TF 기준 쿨다운을 구현하는 정확한 방법이 있나요?
여러 조건에서 TradingAllowed 변수를 동시에 제어할 때 우선순위 설정 방법이 있나요?
60분 주기 시작시 변수 초기화와 쿨다운 로직의 올바른 순서는 무엇인가요?
60분 주기 내 쿨다운 구현 방법에 대한 조언 부탁드립니다.
**추가 질문**
변수 초기화 순서 관련:
// 60분 주기 시작시 초기화 순서가 중요한지?
EntryCount = 0;
TradingAllowed = 1; // 이게 쿨다운을 덮어쓰는 건 아닌지?
InCooldown = 0; // 이 순서가 맞는지?
TF 계산의 정확성:
"TF가 0~59분으로 순환할 때, CooldownStartTF = 45이고 CooldownMinutes = 20이면 TF >= 65가 되어야 하는데, 실제로는 TF가 59를 넘지 않아서 계산이 틀어지는 것 같습니다."
디버깅용 질문:
"쿨다운 상태를 확인할 수 있는 디버깅 방법이나 Text_New로 현재 상태를 표시하는 방법이 있나요?"
감사합니다.
2025-09-17
279
글번호 194095
답변완료
수고하십니다.
A=Stochasticsslow(sto1,sto2)
B=eavg(Stochasticsslow(sto1,sto2),sto3)
지표변수
sto1 6
sto2 5
sto3 3
A 가 B 를 돌파하는 종목
미리 감사드립니다
2025-09-17
196
글번호 194094
답변완료
여러 조건을 변경할때
안녕하세요.
진입조건을 고정하고 청산조건을 변경하려고 할때 어떤 함수로 작성해야 하나요?
진입A
청산조건=A 일때 청산조건A로 청산
청산조건A
청산조건B
청산조건C
--- 등등
마찬가지로 청산조건을 고정하고 진입조건을 여러 조건으로 할때 어떻게 작성해야 하나요?
2025-09-17
272
글번호 194093
답변완료
검색식 변환 부탁드립니다.
B = sum(if(C>O,(H+O+L+C)/4*V/100000000,if(C<O,-(H+O+L+C)/4*V/100000000,0)));
B2 = if(날짜 == 일자, valuewhen(1,date(1)!=date,B(1)),valuewhen(1,date == 날짜 and date(1)!=날짜,B(1)));
B3=B-B2;
Crossup(B3,0)
지표변수
날짜 일자
-----------------------------
변환 부탁드립니다.
즐거운 하루 보내세요~
2025-09-17
223
글번호 194081
답변완료
문의 드립니다
안녕하세요
다음지표 부탁드립니다.
1. 단순이평 8개 (상승,하락시 다른색으로 표현)
2. 지수이평 8개 (상승,하락시 다른색르로 표현)
부탁드립니다
2025-09-17
212
글번호 194079