커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1531
글번호 230811
답변완료
시스템 부탁드립니다.
안녕하세요
늘 도움주셔서 감사합니다.
다음과 같은 조건이 되면 시스템 신호 부탁드립니다.
1. 이평 5 가 볼밴상단과 삼각가중 16, 전환선 10과 다른전환선 40을 crossdn 하면 매도
반대는 매수.
2. 위 조건에서 전환선만 빼고 이평 5 가 볼밴상단과 삼각가중 16을 crossdn 하면 매도.
반대는 매수
* 볼밴과 이평,삼각가중, 전환선은 모두 변수처리 부탁드립니다.
다시한번 감사드립니다.
2025-08-11
230
글번호 193139
답변완료
시간기준 손절 관련
안녕하세요.
아래 수식에서 첫번째 줄은 달러 기준 손절로 정상적으로 손절이 되는데
두번째 시간 기준 손절의 경우, 일정 봉 이후, 손실이 있을 경우에만 청산을 하고자 하며, 이익이 있을 경우, 손절을 하지 않고자 하는데 아래처럼 수식을 작성하면 손실 여부와 상관없이 청산이 되는 것 같습니다.
의도하는 바처럼 손실 중인 경우에만, 시간 기준 손절로 작동하게 하려면 수식을 어떻게 바꾸어야 할까요?
//달러기준 손절
If SL1 > 0 Then setstoploss((SL1/BigPointValue),PointStop);
//시간기준 손절
input: FF(0);
if FF > 0 and BarsSinceEntry > FF and SL1 > 0 Then {
ExitLong("",Atmarket);
ExitShort("",Atmarket); }
2025-08-10
258
글번호 193119
답변완료
부틱드립니다
수고하십니다
트레이딩 뷰 수식입니다.
예스로적용가능하도록 부탁 드립니다.
//@version=3
study(title = "Open Close Cross Strategy R5.1 revised by JustUncleL", shorttitle = "OCC Strategy R5.1", overlay = true)
// === 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)
scolor = input(false, title="Show coloured Bars to indicate Trend?")
delayOffset = input(defval = 0, title = "Delay Open/Close MA (Forces Non-Repainting)", minval = 0, step = 1)
tradeType = input("BOTH", title="What trades should be taken : ", options=["LONG", "SHORT", "BOTH", "NONE"])
// === /INPUTS ===
// Constants colours that include fully non-transparent option.
green100 = #008000FF
lime100 = #00FF00FF
red100 = #FF0000FF
blue100 = #0000FFFF
aqua100 = #00FFFFFF
darkred100 = #8B0000FF
gray100 = #808080FF
// === BASE FUNCTIONS ===
// Returns MA input SEECTion 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
// === /BASE FUNCTIONS ===
// === SERIES SETUP ===
closeSeries = variant(basisType, close[delayOffset], basisLen, offsetSigma, offsetALMA)
openSeries = variant(basisType, open[delayOffset], basisLen, offsetSigma, offsetALMA)
// === /SERIES ===
// === PLOTTING ===
// Get Alternate resolution Series if SEECTed.
closeSeriesAlt = reso(closeSeries, useRes, stratRes)
openSeriesAlt = reso(openSeries, useRes, stratRes)
//
trendColour = (closeSeriesAlt > openSeriesAlt) ? green : red
bcolour = (closeSeries > openSeriesAlt) ? lime100 : red100
barcolor(scolor?bcolour:na, title = "Bar Colours")
closeP=plot(closeSeriesAlt, title = "Close Series", color = trendColour, linewidth = 2, style = line, transp = 20)
openP=plot(openSeriesAlt, title = "Open Series", color = trendColour, linewidth = 2, style = line, transp = 20)
fill(closeP,openP,color=trendColour,transp=80)
// === /PLOTTING ===
//
//
// === ALERT conditions
xlong = crossover(closeSeriesAlt, openSeriesAlt)
alertcondition(xlong, title="xlong signal", message="xlong Alert")
xshort = crossunder(closeSeriesAlt, openSeriesAlt)
alertcondition(xshort, title="xshort signal", message="xshort Alert")
longCond = xlong // alternative: longCond[1]? false : (xlong or xlong[1]) and close>closeSeriesAlt and close>=open
alertcondition(longCond, title="Go LONG signal", message="go long")
shortCond = xshort // alternative: shortCond[1]? false : (xshort or xshort[1]) and close<closeSeriesAlt and close<=open
alertcondition(shortCond, title="Go SHORT", message="Go Short")
// === /ALERT conditions.
// === STRATEGY ===
// stop loss
slPoints = input(defval = 0, title = "Initial Stop Loss Points (zero to disable)", minval = 0)
tpPoints = input(defval = 0, title = "Initial Target Profit Points (zero for disable)", minval = 0)
// Include bar limiting algorithm
ebar = input(defval = 10000, title="Number of Bars for Back Testing", minval=0)
dummy = input(false, title="- SET to ZERO for Daily or Longer Timeframes" )
//
// Calculate how many mars since last bar
tdays = (timenow-time)/60000.0 // number of minutes since last bar
tdays := ismonthly? tdays/1440.0/5.0/4.3/interval : isweekly? tdays/1440.0/5.0/interval : isdaily? tdays/1440.0/interval : tdays/interval // number of bars since last bar
//
//set up exit parameters
TP = tpPoints>0?tpPoints:na
SL = slPoints>0?slPoints:na
2025-08-11
557
글번호 193118
답변완료
로직 검토 요청
다음 종목검색 전체 로직입니다.
Input : 기간(20), R(2), 기준선(55), 허용갭(0.03);
Var : TOP(0), LO(0), DOUBLE(0), BARSSINCE(0), BOX1(False);
Var : var1(0), Var2(0);
Var : 전일근접(False);
// 최고가, 최저가 계산
TOP = Highest(High, 기간);
LO = Lowest(Low, 기간);
// BOX1 조건: 최근 (기간-2)봉 최고가 < (기간-1)봉 최고가
BOX1 = Highest(High, 기간 - 2) < Highest(High, 기간 - 1);
// 최고가 갱신 및 BARSSINCE 계산
If High > TOP[1] Then
Begin
DOUBLE = High;
BARSSINCE = 0;
End
Else
Begin
If DOUBLE > 0 Then
Begin
BARSSINCE = BARSSINCE + 1;
If (BARSSINCE = 기간 - R) and BOX1 Then
Begin
var1 = DOUBLE;
Var2 = LO;
End;
End;
End;
// 전일 종가가 var1 (다박스박스) 돌파 전 3% 이내에 위치했는지 확인
If var1 > 0 Then
Begin
If (Close[1] >= var1 * (1 - 허용갭)) and (Close[1] <= var1) Then
전일근접 = True
Else
전일근접 = False;
End
Else
전일근접 = False;
// 매수 조건
If (var1 > 0) and (전일근접 = True) Then
Begin
If CrossUp(Close, var1) Then
Begin
Find(1);
End;
End;
=========================================================
위 로직 중에서 다음 로직이 계속 오류가 있다고 하는데...
검토 부탁드립니다.
// 전일 종가가 var1 (다박스박스) 돌파 전 3% 이내에 위치했는지 확인
If var1 > 0 Then
Begin
If (Close[1] >= var1 * (1 - 허용갭)) and (Close[1] <= var1) Then
전일근접 = True
Else
전일근접 = False;
End
Else
전일근접 = False;
==================================================================
2025-08-10
312
글번호 193117
답변완료
예스트레이더 종목검색으로 요청합니다^^*
(조건)
주가상한가 이후 캔들이 조정하여 마이너스(-)5%(상단)에서 마이너스(-)10%(하단)밴드라고 할때 캔들이 마이너스(-)5%상단하고 마이너스(-)10%하단사이를
터치 또는 관통하는
양봉 캔들을 찾고 싶습니다..
조건은 30분봉 입니다...
부탁드립니다..
2025-08-10
242
글번호 193116
답변완료
문의드립니다.
안녕하세요 아래 TS에서 사용하는 함수를 예스에서 적용가능하게 부탁드립니다 .
$ATRChander라는 함수입니다 .
Inputs: Multi(numeric), period(numeric);
Var: loss(0), trail(0);
loss = AvgTrueRange(Period) * Multi;
Value1 = $ATRChandelier(Multi,period)[1];
if C > Value1 then trail = Close[0] - loss;
if C < Value1 then trail = Close[0] + loss;
if C > Value1 AND C[1] > Value1 then trail = MaxList(Value1,Close[0] - loss);
if C < Value1 AND C[1] < Value1 then trail = MinList(Value1, Close[0] + loss);
$ATRChandelier=trail;
2025-08-10
234
글번호 193115
답변완료
백테스트에서 미국 서머타임 적용하는 좋은 방법 추천해주세요.
미국 CME 선물시장의 주간 개장시간을 기준을 잡고 싶습니다.
그런데 미국은 서머타임 때문에 한국시간 22:30 일 때도 있고, 23:30 일때도 있습니다.
올 해 2025년을 위한 코드에는 2025-03-09 ~ 2025-11-02 사이에 있으면 서머타임을 적용하는 식으로 날짜를 하드코딩하면 되겠습니다만, 과거 백테스트를 위해서는 어떻게 하는게 효율적일까요?
미국 서머타임은 3월 두 번째 일요일 오전 2시, 그리고 11월 첫 일요일 오전 2시에 변한다는 규칙이 있습니다.
이 규칙을 사용하려면 주어진 년도의 3월 2번째 일요일의 날짜와 11월 첫번째 일요일 날짜를 구해야 합니다. 이런 함수가 예스랭귀지에 있나요?
혹시 시간을 그 종목의 현지 시간(예를 들면 미국 뉴옥시간)으로 설정해서 예스트레이더가 작동되게 하는 방법도 있을까요?
감사합니다.
2025-08-10
330
글번호 193114
답변완료
예스로 부탁합니다.
트뷰에서 알게된 지표인데 예스 수식으로 부탁합니다.
미리감사드립니다.
//version=5
//author: mladen
//rebound arrows and TMA angle caution: Ale
//rewritten from MQL5 to Pine: Brylator
indicator("TMA Centered Bands Indicator", "TMA v1.0 Gaga", overlay = true, max_lines_count = 500, max_labels_count = 500)
//INPUTS
var GRP1 = "Parameters"
HalfLength = input.int(44, "Centered TMA half period", group = GRP1)
string PriceType = input.string("Weighted", "Price to use", options = ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average"], group = GRP1)
AtrPeriod = input.int(120, "Average true range period", group = GRP1)
AtrMultiplier = input.float(2, "Average true range multiplier", group = GRP1)
TMAangle = input.int(4, "Centered TMA angle caution", group = GRP1)
// APPEARANCE (เพิ่มตัวเลือกขนาดและข้อความ BUY/SELL)
var GRP4 = "Appearance"
arrowSizeOpt = input.string("Large", "Arrow size", options = ["Tiny", "Small", "Normal", "Large", "Huge"], group = GRP4)
showBuySellText = input.bool(true, "Show BUY/SELL text on arrows", group = GRP4)
buyText = input.string("BUY", "Buy text", inline = "txt", group = GRP4)
sellText = input.string("SELL", "Sell text", inline = "txt", group = GRP4)
// map ขนาด
arrowSize = switch arrowSizeOpt
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
=> size.huge
//VARIABLES
float tmac = na
float tmau = na
float tmad = na
var float pastTmac = na //from the previous candle
var float pastTmau = na
var float pastTmad = na
float tmau_temp = na //before looping
float tmac_temp = na
float tmad_temp = na
float point = syminfo.pointvalue //NEEDS MORE TESTS
bool last = false //checks if a loop is needed
var string alertSignal = "EMPTY" //needed for alarms to avoid repetition
//COLORS
var GRP2 = "Colors"
var color colorBuffer = na
color colorDOWN = input.color(color.new(color.red, 0), "Bear", inline = "5", group = GRP2)
color colorUP = input.color(color.new(color.green, 0), "Bull", inline = "5", group = GRP2)
color colorBands = input.color(color.new(#b2b5be, 0), "Bands", inline = "5", group = GRP2)
bool cautionInput = input.bool(true, "Caution label", inline = "6", group = GRP2)
//ALERTS
var GRP3 = "Alerts (Needs to create alert manually after every change)"
bool crossUpInput = input.bool(false, "Crossing up", inline = "7", group = GRP3)
bool crossDownInput = input.bool(false, "Crossing down", inline = "7", group = GRP3)
bool comingBackInput = input.bool(false, "Coming back", inline = "7", group = GRP3)
bool onArrowDownInput = input.bool(false, "On arrow down", inline = "8", group = GRP3)
bool onArrowUpInput = input.bool(false, "On arrow up", inline = "8", group = GRP3)
//CLEAR LINES
a_allLines = line.all
if array.size(a_allLines) > 0
for p = 0 to array.size(a_allLines) - 1
line.delete(array.get(a_allLines, p))
//GET PRICE
Price(x) =>
float price = switch PriceType
"Close" => close[x]
"Open" => open[x]
"High" => high[x]
"Low" => low[x]
"Median" => (high[x] + low[x]) / 2
"Typical" => (high[x] + low[x] + close[x]) / 3
"Weighted" => (high[x] + low[x] + close[x] + close[x]) / 4
"Average" => (high[x] + low[x] + close[x] + open[x])/ 4
price
//MAIN
for i = HalfLength to 0
//ATR
atr = 0.0
for j = 0 to AtrPeriod - 1
atr += math.max(high[i + j + 10], close[i + j + 11]) - math.min(low[i + j + 10], close[i + j + 11])
atr /= AtrPeriod
//BANDS
sum = (HalfLength + 1) * Price(i)
sumw = (HalfLength + 1)
k = HalfLength
for j = 1 to HalfLength
sum += k * Price(i + j)
sumw += k
if (j <= i)
sum += k * Price(i - j)
sumw += k
k -= 1
tmac := sum/sumw
tmau := tmac+AtrMultiplier*atr
tmad := tmac-AtrMultiplier*atr
//ALERTS
if i == 0 //Only on a real candle
if (high > tmau and alertSignal != "UP") //crossing up band
if crossUpInput == true //checks if activated
alert("Crossing up Band") //calling alert
alertSignal := "UP" //to avoid repeating
else if (low < tmad and alertSignal != "DOWN") //crossing down band
if crossDownInput == true
alert("Crossing down Band")
alertSignal := "DOWN"
else if (alertSignal == "DOWN" and high >= tmad and alertSignal != "EMPTY") //back from the down band
if comingBackInput == true
alert("Coming back")
alertSignal := "EMPTY"
else if (alertSignal == "UP" and low <= tmau and alertSignal != "EMPTY") //back from the up band
if comingBackInput == true
alert("Coming back")
alertSignal := "EMPTY"
//CHANGE TREND COLOR
if pastTmac != 0.0
if tmac > pastTmac
colorBuffer := colorUP
if tmac < pastTmac
colorBuffer := colorDOWN
//SIGNALS
reboundD = 0.0
reboundU = 0.0
caution = 0.0
if pastTmac != 0.0
if (high[i + 1] > pastTmau and close[i + 1] > open[i + 1] and close < open)
reboundD := high + AtrMultiplier * atr / 2
if (tmac - pastTmac > TMAangle * point)
caution := reboundD + 10 * point
if (low[i + 1] < pastTmad and close[i + 1] < open[i + 1] and close > open)
reboundU := low - AtrMultiplier * atr / 2
if (pastTmac - tmac > TMAangle * point)
caution := reboundU - 10 * point
//LAST REAL
if barstate.islast and i == HalfLength
last := true
tmau_temp := tmau
tmac_temp := tmac
tmad_temp := tmad
//DRAW HANDICAPPED BANDS
if barstate.islast and i < HalfLength
line.new(bar_index - (i + 1), pastTmau, bar_index - (i), tmau, width = 2, style = line.style_dotted, color = colorBands)
line.new(bar_index - (i + 1), pastTmac, bar_index - (i), tmac, width = 2, style = line.style_dotted, color = colorBuffer)
line.new(bar_index - (i + 1), pastTmad, bar_index - (i), tmad, width = 2, style = line.style_dotted, color = colorBands)
//DRAW SIGNALS (ลูกศรใหญ่ขึ้น + มีคำว่า SELL/BUY)
if reboundD != 0
txtDown = showBuySellText ? "▼₩n" + sellText : "▼"
label.new(bar_index - (i), reboundD, txtDown, color = na, style = label.style_label_center, textcolor = colorDOWN, size = arrowSize, textalign = text.align_center)
if i == 0 and onArrowDownInput == true //alert
alert("Down arrow")
if caution != 0 and cautionInput == true
label.new(bar_index - (i), reboundD, color = colorUP, style = label.style_xcross, size = size.tiny, textcolor = na)
if reboundU != 0
txtUp = showBuySellText ? "▲₩n" + buyText : "▲"
label.new(bar_index - (i), reboundU, txtUp, color = na, style = label.style_label_center, textcolor = colorUP, size = arrowSize, textalign = text.align_center)
if i == 0 and onArrowUpInput == true //alert
alert("UP arrow")
if caution != 0 and cautionInput == true
label.new(bar_index - (i), reboundU, color = colorDOWN, style = label.style_xcross, size = size.tiny, textcolor = na)
//SAVE HISTORY
pastTmac := tmac
pastTmau := tmau
pastTmad := tmad
//LOOP IS ONLY FOR HANDICAPPED
if barstate.islast != true
break
//DRAW REAL BANDS
plot(last ? tmau_temp : tmau, title = "TMA Up", color = colorBands, linewidth=1, style = plot.style_line, offset = -HalfLength)
plot(last ? tmac_temp : tmac, title = "TMA Mid", color = colorBuffer, linewidth=1, style = plot.style_line, offset = -HalfLength)
plot(last ? tmad_temp : tmad, title = "TMA Down", color = colorBands, linewidth=1, style = plot.style_line, offset = -HalfLength)
2025-08-10
482
글번호 193113
답변완료
종목검색식 부탁드립니다
1. 일봉기준 차트에서,
주봉 20 이평선 (단순) 을 표시하여 (그어서)
일봉 캔들이 양봉으로 주봉 20이평선을 몸통으로
관통(종가로 돌파)하는 종목검색식 부탁드립니다.
2025-08-10
252
글번호 193112