커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
8022
글번호 230811
답변완료
문의 드립니다.
안녕하세요
항상 감사드립니다.
아래의 서식에서 추가 서식 부탁드립니다.
*진입조건추가
1. 진입 수량 추가: 10계약
2. 전일 수익이 마이너스 일시 당일은 1/2로 줄여서(5계약) 진입, 당일도 마이너스이면 그 다음날도 같은 5계약(1/2)으로 진입
3. 전일 수익이 플러스 일때는 기존 계약 그대로 진입 (10계약)
*전일 마이너스 수익이 나면 진입 규모를 1/2로 줄이고, 수익이 나면 기존 계약수 대로 진입하는 전략입니다.
** 진입 수량 추가가 어려우면 전일 마이너스 수익시 절반만 진입한다는 로직만 추가해주시면 됩니다.
# KOSPI 선물 10분봉
input: 당일진입횟수(3);
Input: chkP(3), reChkP(10), stopChk(20);
var: HH(0), LL(0), BS(0), SS(0);
var: dayChk(0);
var : TotalCount(0),PreDay(0),DayEntry(0);
TotalCount = TotalTrades;
if Bdate != Bdate[1] Then
PreDay = TotalCount[1];
DayEntry = (TotalCount-PreDay)+IFF(MarketPosition != 0,1,0);
if BarIndex == 0 then ClearDebug();
if dayindex == chkP then
{
HH = Highest(Max(C,O), chkP+1);
LL = Lowest(Min(C,O), chkP+1);
#if date == 20240612 then messageLog("--HH %.2f, LL: %.2f", HH, LL);
}
#if High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then messageLog("HH %.2f, High: %.2f", HH, High);
if DayIndex >= chkP
# and Time < 95000
and sDate == NextBarSdate
and EntryDate(0) < Date
and EntryDate(1) < Date
and DayEntry < 당일진입횟수
Then {
Buy("B1", AtStop, HH);
Sell("S1", AtStop, LL);
}
//if dayChk == 0 and High >= HH and MarketPosition == 0 and ExitDate(1) < Date and time > 93000 then {
// messageLog("HH %.2f, High: %.2f", HH, High);
// dayChk = 1;
//}
if ExitDate(1) == Date
and Time < 150000
// and LatestEntryName(1) != "B2"
// and LatestEntryName(1) != "S2"
// and LatestEntryName(0) != "B2"
// and LatestEntryName(0) != "S2"
Then
{
if DayIndex < reChkP Then
{
HH = Highest(Max(C,O), DayIndex+1);
LL = Lowest(Min(C,O), DayIndex+1);
}
Else
{
HH = Highest(Max(C,O), reChkP);
LL = Lowest(Min(C,O), reChkP);
}
if DayEntry < 당일진입횟수 Then
{
Buy("B2", AtStop, HH);
Sell("S2", AtStop, LL);
}
}
if (MarketPosition == 1) Then {
if DayIndex < stopChk Then {
BS = Lowest(Min(C,O), DayIndex+1);
}
Else {
BS = Lowest(Min(C,O), stopChk);
}
ExitLong("EL", AtStop, BS);
}
if (MarketPosition == -1) Then {
if DayIndex < stopChk Then {
SS = Highest(Max(C,O), DayIndex+1);
}
Else {
SS = Highest(Max(C,O), stopChk);
}
#messageLog(" SS %.2f", SS);
ExitShort("ES", AtStop, SS);
}
var : month(0),nday(0),week(0),X(False);
month = int(date/100)-int(date/10000)*100;
nday = date - int(date/100)*100;
Week = DayOfWeek(date);
#만기일
if (month%3 == 0 and nday >= 8 and nday <= 14 and week == 4) then
{
X = true;
SetStopEndofday(151500);
}
Else#만기일아닐때
{
X = False;
SetStopEndofday(152000);
}
2025-07-21
834
글번호 192618
답변완료
수식부탁드립니다
20일선과 60일선의 골든과 데드를 기준으로 매수시 : 매수신호 캔들 최저가 라인과 수치표시 매도시 : 매도신호 캔들 최고가 라인과 수치표시
2025-07-21
324
글번호 192616
답변완료
문의 드립니다.
안녕하세요 ~
현재 가격이 아래의 강도파동 선을 돌파하는 검색식 부탁 드립니다.
// 누적 거래량 계산
cumulative_buying = eavg(if(C>O, (((H-L)-(if(C>O,H-C,H-O)+if(C>O,O-L,C-L)))/(H-L) + ((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V, (((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V), cumulation_length);
cumulative_selling = eavg(if(C<O, (((H-L)-(if(C>O,H-C,H-O)+if(C>O,O-L,C-L)))/(H-L) + ((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V, (((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V), cumulation_length);
// 거래량 강도 파동의 EMA
volume_strength = if(cumulative_buying > cumulative_selling, cumulative_buying, cumulative_selling);
eavg(volume_strength, cumulation_length)
지표조건
cumulation_length 14
감사합니다.
2025-07-21
339
글번호 192613
답변완료
시스템 부탁드립니다
1.테스트 1
- 월 1회 매수 진입 날짜(1-30일), 시간 랜덤으로해서 월 1회만 진입하도록 1회 진입이후 랜덤숫자 변경되도록 부탁드립니다.
2.테스트2
- 주 1회 매수 진입 진입 요일, 시간 랜덤으로, 1회 진입이후 랜덤숫자가 변경되도록 부탁드립니다.
2025-07-21
508
글번호 192612
답변완료
검색식 부탁합니다.
1. 전환선이 기준선을 골든크로스 할때 종목검색식 부탁드려요.
2. 전환선이 기준선 을 골든크로스 할때
(단, 0봉전~20봉전 모든종목)
검색식 부탁합니다.
3. 일봉 전환선이 주봉 20이평(단순)을 돌파할때 검색식
4. 일봉 기준선이 주봉 20이평(단순)을 돌파할때 검색식
5. 이격도 10 과 이격도 60이 1%이하로 근접하여 0기준선 돌파 할때 종목검색식
6. 이격도10 과 이격도 60이 1%이하로 근접한 종목검색식
2025-07-21
408
글번호 192611
답변완료
문의 드립니다.
아래 내용을 전환 가능한가요?
답변 감사합니다.
src = close
keyvalue = input(3, title = "Key Vaule. 'This changes the sensitivity'", step = .5)
atrperiod = input(10, title="ATR Period")
xATR = atr(atrperiod)
nLoss = keyvalue * xATR
xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))
pos = 0
pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue
plot(xATRTrailingStop, color = xcolor, title = "Trailing Stop")
2025-07-21
470
글번호 192610
답변완료
수식 부탁드립니다
지표식 부탁 드립니다.
//@version=5
indicator("Cumulative Volume Delta", "CVD", format=format.volume)
anchorInput = input.timeframe("1D", "Anchor period")
lowerTimeframeTooltip = "The indicator scans lower timeframe data to approximate up and down volume used in the delta calculation. By default, the timeframe is chosen automatically. These inputs override this with a custom timeframe.₩n₩nHigher timeframes provide more historical data, but the data will be less precise."
useCustomTimeframeInput = input.bool(false, "Use custom timeframe", tooltip = lowerTimeframeTooltip)
lowerTimeframeInput = input.timeframe("1", "Timeframe")
autoSwitchInput = input.bool(true, "Auto Switch Feature", tooltip="Turn on to automatically control visibility based on timeframe.")
upAndDownVolume() =>
posVol = 0.0
negVol = 0.0
var isBuyVolume = true
switch
close > open => isBuyVolume := true
close < open => isBuyVolume := false
close > close[1] => isBuyVolume := true
close < close[1] => isBuyVolume := false
if isBuyVolume
posVol += volume
else
negVol -= volume
posVol + negVol
var lowerTimeframe = switch
useCustomTimeframeInput => lowerTimeframeInput
timeframe.isseconds => "1S"
timeframe.isintraday => "1"
timeframe.isdaily => "5"
=> "60"
diffVolArray = request.security_lower_tf(syminfo.tickerid, lowerTimeframe, upAndDownVolume())
getHighLow(arr) =>
float cumVolume = na
float maxVolume = na
float minVolume = na
for item in arr
cumVolume := nz(cumVolume) + item
maxVolume := math.max(nz(maxVolume), cumVolume)
minVolume := math.min(nz(minVolume), cumVolume)
[maxVolume, minVolume, cumVolume]
[maxVolume, minVolume, lastVolume] = getHighLow(diffVolArray)
var cumulLastVolume = 0.0
anchorChange = timeframe.change(anchorInput) or (not na(lastVolume) and na(lastVolume[1]))
cumulOpenVolume = anchorChange ? 0.0 : cumulLastVolume[1]
cumulMaxVolume = cumulOpenVolume + maxVolume
cumulMinVolume = cumulOpenVolume + minVolume
cumulLastVolume := cumulOpenVolume + lastVolume
var float cumVolLine = na
cumVolLine := cumulLastVolume
// Determine if the current timeframe is intraday or daily and above
is_intraday = timeframe.isintraday
// Determine what to plot based on auto switch setting
plotCVD = autoSwitchInput ? is_intraday : true
// Plotting with color change based on value
plot(plotCVD ? cumVolLine : na, title="Cumulative Volume Delta", color=cumVolLine >= 0 ? color.green : color.red, linewidth=2)
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)
2025-07-21
1081
글번호 192609
답변완료
안녕하세요. 슈퍼트렌드 시스템트레이딩 부탁드립니다.
/*최근 가장 인기 있는 지표 중 하나인 SuperTrend 지표를 이용한 전략으로
종가가 SuperTrend 상단 채널을 상향돌파하면 매수하고,
종가가 SuperTrend 하단 채널을 하향이탈하면 매도하는 전략입니다.
추세추종형 전략으로 큰 추세가 잘 나오는 전략에 유용합니다.*/
input : 투자금액(1000000);
input : factor(3), AtrPeriod(10);
Var : 누적자산(0), 수량(0);
var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0);
누적자산 = 투자금액 + netprofit;
수량 = int(투자금액/Close);
if CurrentBar > 1 Then {
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
source = max(high - low, abs(high - close[1]), abs(low - close[1]));
ATrV = alpha * source + (1 - alpha) * ATrV[1]; //지수가중이평방식
upperBand = src + factor * AtrV;
lowerBand = src - factor * AtrV;
prevLowerBand = lowerBand[1];
prevUpperBand = upperBand[1];
if lowerBand > prevLowerBand or close[1] < prevLowerBand Then
lowerBand = lowerBand;
Else
lowerBand = prevLowerBand;
if upperBand < prevUpperBand or close[1] > prevUpperBand Then
upperBand = upperBand;
Else
upperBand = prevUpperBand;
if C > UpperBand Then
direction = 1;
if C < LowerBand Then
direction = -1;
if direction == 1 Then
supertrend = lowerband;
Else
supertrend = upperband;
}
# 매수
if CrossUp(C, upperBand) Then
Buy("Buy", OnClose, Def, 수량);
# 매수청산
if CrossDown(C, lowerBand) Then
ExitLong("EL");
안녕하세요. 예스스탁 대표님께서 만들어주신 슈퍼트렌드 시스템 트레이딩 코딩인데 여기서 투자금액이랑 수량은 빼고
선물에 적용하고싶어 매수,매도 다 되는 코딩으로 만들어주시면 감사하겠습니다!
2025-07-20
1217
글번호 192608
답변완료
월봉의 최근캔들(고점까지) 추세선 고점높이까지 안돼는데 수정부탁드립니다
차트 그림에서와 같이 월봉최근캔들(추세선이 고점까지 되게끔)에서 추세선이 고점까지 안되는데 수정부탁드립니다
==============================================
input : Period(35),선두께(2);
Var:상승색(Turquoise), 하락색(Turquoise);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),tl9(0),
date21(0),date22(0),time21(0),time22(0),diff(0),diffr(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0),box(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if monthhigh(0)[1] < monthhigh(0) Then
T = 1;
if monthlow(0)[1] > monthlow(0) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,하락색);
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Blue);
Box_SetFill(box,true,100,true);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
var1 = Index;
Var2 = var1[1];
if var2 > 0 Then
{
diff = value12;
diffr = (value12-value11)/value11*100;
TX = Text_New(sDate,sTime,value12,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,1,0);
Text_SetColor(tx,Blue);
Text_SetSize(tx,12);
}
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
diff = value12;
diffr = (value12-value11)/value11*100;
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
var1 = Index;
if var2 > 0 Then
Box_SetEnd(box,date12,time12,Value12);
{
Text_SetLocation(tx,sDate,sTime,value12);
Text_SetString(tx,NumToStr(diffr,2)+"%");
}
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,상승색);
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Red);
Box_SetFill(box,true,100,true);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
var1 = Index;
Var2 = var1[1];
if var2 > 0 Then
{
diff = value12;
diffr = (value12-value11)/value11*100;
TX = Text_New(sDate,sTime,value12,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Red);
Text_SetSize(tx,12);
}
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
diff = value12;
diffr = (value12-value11)/value11*100;
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
var1 = Index;
if var2 > 0 Then
Box_SetEnd(box,date12,time12,Value12);
{
Text_SetLocation(tx,sDate,sTime,value12);
Text_SetString(tx,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,1,1);
}
}
}
TL_SetSize(TL1,선두께);
TL_SetDrawMode(TL1,0);
Text_SetSize(tx,15);
2025-07-21
544
글번호 192607