커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1531
글번호 230811
답변완료
수식 완성부탁드립니다.
input : Period(20),Period1(5),Period2(20),A(0);
var1 = ma(C,Period);
Var2 = ma(C,Period2);
Var3 = (ma(c,Period1)-Var2)/C*100;
if Crossup(C,Var1) and Var2 > Var2[1] and Var2[1] < Var2[2] and
CrossUp(Var3,A) Then
Find(1);
고생이 많으십니다.
위 수식을 지표식과 검색식으로 각각 변환 부탁드립니다.
감사합니다.
2025-08-04
236
글번호 192968
답변완료
질문 부탁드립니다
수고가 많으십니다
h>l*1.10 이라는 조건이
1.분봉상에서 조건만족이 당일 처음일때만 나오게 하기 (당일 첫봉이 아닌, 당일 처음으로 발생했을때)
2. 당일 3번째까지 나오게 하기
3. 만약 당일 조건만족이 없을경우 이후에 조건만족이 발생할때, 전후의 거래일 차이를 저장한뒤
그 거래일 이상의 간격으로 만족하는 경우를 찾게 하려고 합니다
예시) 조건만족 발생 - 다음거래일 조건만족 없음 (A 시점) - A 시점 기준 3거래일 후에 만족 발생 한다면 앞으로는 전후가 3거래일 이상 차이가 나는 (3일 후, 4일 후..등 3거래일 이상) 경우에만 만족봉의 고가값을 찾음.
작성을 부탁드립니다
감사합니다
2025-08-05
231
글번호 192967
답변완료
틱봉에서 ADX, DM DP계산하기
더운데 수고 많으시죠!
아래 3개의 지표를 각각 틱 차트에서 DATA2를 사용하지 않고, 5분BOX를 기준으로 계산해서 사용해보고자 합니다.
var1 = ADX(11);
var2 = DiPlus(11);
var3 = DiMinus(11);
감사합니다!
2025-08-04
234
글번호 192966
답변완료
변환 부탁드립니다.
트레이딩 뷰 지표입니다.
변환 부탁 드립니다.
//@version=6
indicator("Zone Shift [ChartPrime]", max_lines_count = 500, overlay = true, max_labels_count = 500)
// --------------------------------------------------------------------------------------------------------------------}
// ?? ???????? ????????????
// --------------------------------------------------------------------------------------------------------------------{
int length = input.int(100, "Length 60-200", minval = 60, maxval = 200)
color upColor = input.color(color.lime, "", inline = "colors")
color dnColor = input.color(color.blue, "", inline = "colors")
// --------------------------------------------------------------------------------------------------------------------}
// ?? ?????????????????? ????????????????????????
// --------------------------------------------------------------------------------------------------------------------{
var trend = false
var trendStart = float(na)
var lastRetest = bar_index
float ema = ta.ema(close, length)
float hma = ta.hma(close, length-40)
float dist = ta.sma(high-low, 200)
float mid = math.avg(ema, hma)
float top = mid + dist
float bot = mid - dist
if barstate.isconfirmed
if low > top and low[1] < top[1] and not trend
trend := true
trendStart := low
if high < bot and high[1] > bot[1] and trend
trend := false
trendStart := high
trend_col = trend ? upColor : dnColor
// Retest TrendStart Level
if barstate.isconfirmed
if (close > trendStart and close[1] < trendStart[1] or low > trendStart and low[1] < trendStart[1] ) and trend and bar_index - lastRetest > 5
lastRetest := bar_index
label.new(bar_index, low, "?", color = color.new(color.black, 100), style = label.style_label_up, textcolor = trend_col)
if (close[1] > trendStart and close < trendStart[1] or high[1] > trendStart and high < trendStart[1]) and not trend and bar_index - lastRetest > 5
lastRetest := bar_index
label.new(bar_index, high, "?", color = color.new(color.black, 100), style = label.style_label_down, textcolor = trend_col)
// --------------------------------------------------------------------------------------------------------------------}
// ?? ??????????????????????????
// --------------------------------------------------------------------------------------------------------------------{
plot(mid, "Middle", color = bar_index % 2 == 0 ? chart.fg_color : na)
plot(top, "Top", color = chart.fg_color )
plot(bot, "Bottom", color = chart.fg_color )
barcolor(trend_col)
plotcandle(open, high, low, close, title='CandleColor', color = trend_col, wickcolor=trend_col, bordercolor = trend_col, force_overlay = true)
plot(trendStart != trendStart[1] ? na : trendStart, "Trend Initiation Level", style = plot.style_linebr, color = bar_index % 2 == 0 ? chart.fg_color : na)
// --------------------------------------------------------------------------------------------------------------------}
2025-08-04
307
글번호 192965
답변완료
화살표 표시가 되지 않습니다.
안녕하세요
Q&A 92545 글의 답글을 보고 아래와 같이 코드를 작성하였습니다.
input : short(10),long(100);
var : macdv(0),tx(0);
macdv = macd(short,long);
Plot1(macdv);
PlotBaseLine1(0);
if CrossUp(macdv,0) Then
{
tx = Text_New(sDate,sTime,macdv,"▲");
Text_SetColor(tx,Red);
Text_SetSize(tx,20);
}
새로운 지표로 만들어서 지표 적용하기를 하면 첨부의 그림과 같이
신호선은 생성이 됩니다만 신호 발생지점에서 ▲ 는 생성되지 않고 있습니다.
왜 그런지 이유를 알 수 있을까요?
답변에 미리 감사드립니다.
2025-08-04
260
글번호 192964
답변완료
Kalman지표를 변화과정에서 반복인 오류가 발생합니다.
Tradingview에 있는 "Kalman Trend Levels [BigBeluga]"의 수식을 ChatGPT로 변환을 시켰습니다.
기존 코딩은
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// https://creativecommons.org/licenses/by-nc-sa/4.0/
// © BigBeluga
//@version=5
indicator("Kalman Trend Levels [BigBeluga]", overlay = true, max_labels_count = 500, max_boxes_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int short_len = input.int(50)
int long_len = input.int(150)
bool retest_sig = input.bool(false, "Retest Signals")
bool candle_color = input.bool(true, "Candle Color")
color upper_col = input.color(#13bd6e, "up", inline = "colors")
color lower_col = input.color(#af0d4b, "dn", inline = "colors")
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float atr = ta.atr(200) *0.5
var lower_box = box(na)
var upper_box = box(na)
// Kalman filter function
kalman_filter(src, length, R = 0.01, Q = 0.1) =>
// Initialize variables
var float estimate = na
var float error_est = 1.0
var float error_meas = R * (length)
var float kalman_gain = 0.0
var float prediction = na
// Initialize the estimate with the first value of the source
if na(estimate)
estimate := src[1]
// Prediction step
prediction := estimate
kalman_gain := error_est / (error_est + error_meas)
estimate := prediction + kalman_gain * (src - prediction)
error_est := (1 - kalman_gain) * error_est + Q / (length) // Adjust process noise based on length
estimate
float short_kalman = kalman_filter(close, short_len)
float long_kalman = kalman_filter(close, long_len)
bool trend_up = short_kalman > long_kalman
color trend_col = trend_up ? upper_col : lower_col
color trend_col1 = short_kalman > short_kalman[2] ? upper_col : lower_col
color candle_col = candle_color ? (trend_up and short_kalman > short_kalman[2] ? upper_col : not trend_up and short_kalman < short_kalman[2] ? lower_col : color.gray) : na
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if trend_up and not trend_up[1]
label.new(bar_index, short_kalman, "🡹₩n" + str.tostring(math.round(close,1)), color = color(na), textcolor = upper_col, style = label.style_label_up, size = size.normal)
lower_box := box.new(bar_index, low+atr, bar_index, low, border_color = na, bgcolor = color.new(upper_col, 60))
if not ta.change(trend_up)
lower_box.set_right(bar_index)
if trend_up[1] and not trend_up
label.new(bar_index, short_kalman, str.tostring(math.round(close,1))+"₩n🢃", color = color(na), textcolor = lower_col, style = label.style_label_down, size = size.normal)
upper_box := box.new(bar_index, high, bar_index, high-atr, border_color = na, bgcolor = color.new(lower_col, 60))
if not ta.change(trend_up)
upper_box.set_right(bar_index)
if retest_sig
if high < upper_box.get_bottom() and high[1]>= upper_box.get_bottom() //or high < lower_box.get_bottom() and high[1]>= lower_box.get_bottom()
label.new(bar_index-1, high[1], "x", color = color(na), textcolor = lower_col, style = label.style_label_down, size = size.normal)
if low > lower_box.get_top() and low[1]<= lower_box.get_top()
label.new(bar_index-1, low[1], "+", color = color(na), textcolor = upper_col, style = label.style_label_up, size = size.normal)
p1 = plot(short_kalman, "Short Kalman", color = trend_col1)
p2 = plot(long_kalman, "Long Kalman", linewidth = 2, color = trend_col)
fill(p1, p2, short_kalman, long_kalman, na, color.new(trend_col, 80))
plotcandle(open, high, low, close, title='Title', color = candle_col, wickcolor=candle_col, bordercolor = candle_col)
// }
이렇게 되어 있습니다.
그리고 변환을 시켰을 때
// 예스트레이더 지표식: Kalman Trend Levels [BigBeluga] 변환본 (YesLanguage)
// 차트 편집창용 지표 스크립트입니다. 충분한 주석을 참고하세요.
Inputs:
ShortLen(50), // 단기 칼만 필터 기간
LongLen(150), // 장기 칼만 필터 기간
RetestSig(False), // 리테스트 시그널 표시 여부
CandleColor(True), // 캔들 컬러링 사용 여부
UpColor(RGB(19,189,110)), // 상승 트렌드 색상 (녹색 계열)
DnColor(RGB(175,13,75)); // 하락 트렌드 색상 (빨강 계열)
Vars:
// 단기 칼만 필터 내부 변수
ShortEst(0), // 단기 추정치
ShortErrEst(1), // 단기 오차 추정치
ShortErrMeas(0), // 단기 측정 오차
ShortKGain(0), // 단기 칼만 이득
PredShort(0), // 단기 예측치
// 장기 칼만 필터 내부 변수
LongEst(0), // 장기 추정치
LongErrEst(1), // 장기 오차 추정치
LongErrMeas(0), // 장기 측정 오차
LongKGain(0), // 장기 칼만 이득
PredLong(0), // 장기 예측치
ATRVal(0), // ATR 값 (200 기간 * 0.5)
// 박스 개체 ID 저장용
LowerBoxID(0),
UpperBoxID(0),
// 트렌드 상태
TrendUp(False),
TrendCol(0),
TrendCol1(0);
// 측정 오차 초기화 (필터 길이에 비례)
ShortErrMeas = 0.01 * ShortLen;
LongErrMeas = 0.01 * LongLen;
// ATR 계산: 200-period ATR의 절반 사용
ATRVal = ATR(200) * 0.5;
// 첫 번째 바에서 초기 추정값 세팅
if CurrentBar = 1 then
begin
ShortEst = C; // 첫 봉의 종가로 초기화
LongEst = C; // 첫 봉의 종가로 초기화
end;
// ===== 단기 칼만 필터 계산 =====
PredShort = ShortEst; // 예측 단계
ShortKGain = ShortErrEst / (ShortErrEst + ShortErrMeas); // 칼만 이득
ShortEst = PredShort + ShortKGain * (C - PredShort); // 추정치 보정
ShortErrEst = (1 - ShortKGain) * ShortErrEst + 0.1 / ShortLen; // 오차 추정치 갱신
// ===== 장기 칼만 필터 계산 =====
PredLong = LongEst;
LongKGain = LongErrEst / (LongErrEst + LongErrMeas);
LongEst = PredLong + LongKGain * (C - PredLong);
LongErrEst = (1 - LongKGain) * LongErrEst + 0.1 / LongLen;
// ===== 트렌드 판정 =====
TrendUp = ShortEst > LongEst; // 단기 > 장기 → 상승
TrendCol = Iff(TrendUp, UpColor, DnColor); // 트렌드 컬러
TrendCol1 = Iff(ShortEst > ShortEst[2], UpColor, DnColor); // 단기 추정 증감 색상
// ===== 차트 출력 =====
Plot1(ShortEst, "ShortKalman"); // 단기 칼만 필터 값
Plot2(LongEst, "LongKalman"); // 장기 칼만 필터 값
// 캔들 컬러링: PlotPaintBar 함수 사용
if CandleColor then
PlotPaintBar(
O, H, L, C,
Iff(TrendUp and (ShortEst > ShortEst[2]), UpColor,
Iff((not TrendUp) and (ShortEst < ShortEst[2]), DnColor,
RGB(128,128,128))) // 그 외는 회색
);
// ===== 트렌드 전환 시 화살표 및 박스 표시 =====
// 상승 전환: 상승 화살표 및 하단 박스
if (TrendUp) and (not TrendUp[1]) then
begin
Text_New(
Date, Time,
ShortEst,
"🡹 " + NumToStr(C, 1) // 화살표 + 종가(소수점 1자리)
);
LowerBoxID = Box_New(
Date, Time, L,
Date, Time, L + ATRVal
);
Box_SetFill(LowerBoxID, UpColor); // 박스 내부 채움 색
Box_SetExtFill(LowerBoxID, True); // 차트 전체 영역으로 확장
end;
// 하락 전환: 하락 화살표 및 상단 박스
if (not TrendUp) and (TrendUp[1]) then
begin
Text_New(
Date, Time,
ShortEst,
NumToStr(C, 1) + " 🢃" // 종가 + 하락 화살표
);
UpperBoxID = Box_New(
Date, Time, H + ATRVal,
Date, Time, H
);
Box_SetFill(UpperBoxID, DnColor);
Box_SetExtFill(UpperBoxID, True);
end;
// ===== 리테스트 시그널 (옵션) =====
if RetestSig then
begin
// 상승 박스 상단 돌파 리테스트 표시
if (H < Box_GetEndVal(UpperBoxID)) and (H[1] >= Box_GetEndVal(UpperBoxID)) then
Text_New(Date, Time, H, "x");
// 하락 박스 하단 돌파 리테스트 표시
if (L > Box_GetEndVal(LowerBoxID)) and (L[1] <= Box_GetEndVal(LowerBoxID)) then
Text_New(Date, Time, L, "+");
end;
몇가지 단순 오류를 고쳤지만, 반복적인 수정을 하니 내용을 편집해서 결론을 내는 것을 확인했습니다.
이런 수정이 가능할까요?
2025-08-04
614
글번호 192963
답변완료
시스템 자동매매관련 일반 질문입니다...
에를 들어서 3천만원 기준자산으로 자동매매를 하는데 계좌에 자산은 3천만원 입니다.,
제가 매수 증거금을 고려해서 시스템 트레이딩설정에 고정자산을 2900만원으로
설정을해 두었는데, 매수증거금이 부족합니다, 라고 접수오류가 떳는데
궁금해서 문의합니다..
장내최대가능 현금하고 예수금조회도 해보아도 충분히 금액이 있는데 매수가
안되었습니다...
2025-08-04
247
글번호 192962
답변완료
검색식 문의
주가등락폭 비율
0봉전 저가고가 폭 대비 0봉전 저가종가 폭의 비율이 0% 이상 50% 이하
검색식 부탁드립니다
2025-08-04
259
글번호 192961
답변완료
검색식 부탁 드립니다
B=BBandsC(Period,D1)
지표조건
Period 20
D1 2
A1= LinearRegressionValue(C,기간1,0);
A2= LinearRegressionValue(A1,기간1,0);
eq=A1-A2;
VL=A1+eq;
지표조건
기간1 50
분봉에서 B 가 VL 아래에 있다 B가 VL 위로 올라온 종목 검색식 부탁드립니다
2025-08-04
243
글번호 192960