커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1535
글번호 230811
답변완료
문의 드립니다.
아래 내용을 전환 가능한가요?
답변 감사합니다.
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
235
글번호 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
300
글번호 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
340
글번호 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
232
글번호 192607
답변완료
기초적인 질문입니다.
안녕하세요. 항상 수고가 많으십니다.
수식 마지막 단계에서
if 조건 && index>224 Then Find(1);
여기서 index>224는 조건을 만족하는 현재봉이 224선 위에 있다는건가요?
너무 기초적인 질문이지만 배우는 과정에서 잘 알고 넘어가야 할거 같아서요
2025-07-20
204
글번호 192606
답변완료
전략작성등
A=H(1)-L(1);
A1=O+A*0.5;
valuewhen(1,crossup(c,A1),A1)
이평5일선=ma(c,5);
상단선=
Hc=Max(C,O);
Lc=Min(C,O);
HH=Highest(Hc,횡보기간);
LL=Lowest(Lc,횡보기간);
HH
CrossUp(cci(20),0)&&
CrossUp(diplus(14,
diminus(14))
상기4개의 선또는 수식이 5%이내에 수렴하고 이를 동시에 돌파하는 종목검색수식이 가능할까요 부탁드립니다^^
2025-07-20
223
글번호 192605
답변완료
수식 부탁드립니다.
아래는 이전질문코드에 답을 주신건데
1분봉이나 5분봉에서
length값을 240으로 늘리면 값이 0으로 나오는데 length값을 늘렸을 경우에도
값이 제대로 나오게 할 수 있는 방법이 있을까요?
Inputs: length(55);
var : x(0),y(0),halfLength(0),sqrtLength(0),ii(0);
var : sum(0),Csum(0),sum1(0),csum1(0),sum2(0),csum2(0);
var : WMA1(0),WMA2(0),diff1(0),hma1(0);
var : sum5(0),Csum5(0),sum51(0),csum51(0),sum52(0),csum52(0);
var : WMA51(0),WMA52(0),diff5(0),hma2(0);
var : prev_hma1(0),prev_hma2(0),vol_sum(0),level(0),shift_col(0);
var : reversal_dn_signal(0),reversal_up_signal(0);;
halfLength = IntPortion(length / 2);
sqrtLength = IntPortion(Sqrt(length));
if Bdate != Bdate[1] Then
{
prev_hma1 = hma1[1];
prev_hma2 = hma2[1];
}
Sum = 0;
CSum = 0;
Sum5 = 0;
CSum5 = 0;
For x = 0 to sqrtLength-1
{
Sum1 = 0;
CSum1 = 0;
Sum2 = 0;
CSum2 = 0;
Sum51 = 0;
CSum51 = 0;
Sum52 = 0;
CSum52 = 0;
ii = 0;
For y = x+0 to x+length-1
{
if ii < halfLength Then
{
Sum1= Sum1 + DayClose(y) * (halfLength - ii);
CSum1 = CSum1 + halfLength - ii;
Sum51 = Sum51 + DayClose(y+5) * (halfLength - ii);
CSum51 = CSum51 + halfLength - ii;
}
if ii < Length Then
{
Sum2= Sum2 + DayClose(y) * (Length - ii);
CSum2 = CSum2 + Length - ii;
Sum52 = Sum52 + DayClose(y+5) * (Length - ii);
CSum52 = CSum52 + Length - ii;
}
ii = ii+1;
}
WMA1 = Sum1 / CSum1;
WMA2 = Sum2 / CSum2;
diff1 = 2 * wma1 - wma2;
Sum = Sum + diff1 * (sqrtLength - x);
CSum = CSum + sqrtLength - x;
WMA51 = Sum51 / CSum51;
WMA52 = Sum52 / CSum52;
diff5 = 2 * wma51 - wma52;
Sum5 = Sum5 + diff5 * (sqrtLength - x);
CSum5 = CSum5 + sqrtLength - x;
}
hma1 = sum/Csum;
hma2 = sum5/Csum5;
vol_sum = DayVolume(2) + dayVolume(0) + DayVolume(0);
IF NextBarBdate != Bdate Then
{
if (prev_hma1 <= prev_hma2) and (hma1 > hma2) then
begin
level = DayLow;
end
else if (prev_hma1 >= prev_hma2) and (hma1 < hma2) then
begin
level = DayHigh;
end
else
begin
level = level[1];
end;
// 바 색상 숫자 (1=Up, 0=Down)
if DayClose < level then
begin
shift_col = 0;
end
else
begin
shift_col = 1;
end;
// 반전 신호 조건
reversal_dn_signal = 0;
reversal_up_signal = 0;
if (dayHigh(2) < level) and (DayHigh < level) and (DayHigh(1) > level) then
reversal_dn_signal = 1;
if (dayLow(2) > level) and (dayLow(1) < level) and (DayLow > level) then
reversal_up_signal = 1;
}
// 결과 플롯
Plot1(level, "Market Level");
2025-07-20
267
글번호 192604
딸바보07 님에 의해서 삭제되었습니다.
2025-07-20
12
글번호 192603
답변완료
종목검색 부탁드립니다.
수고 많으십니다.
총 4가지의 조건검색식을 각각 요청 드립니다.
----------------------------------------
1. 3분봉에서 A 수식을 돌파할 때 검색
< 수식 A >
조건=crossup(c,((predayhigh()+
predaylow()+predayclose())/3)
+(predayhigh()-predaylow()));
Valuewhen(1,조건,C);
----------------------------------------
2. 3분봉에서 수식 A을 돌파 후 데드크로스하여, 수식 B의 ±1% (당일 또는 며칠 후 라도) 구간에서 검색
< 수식 B >
구 = BBandsUp(240,3);
간 = BBandsUp(240,1.5);
단타 = countSince(date!= date(1), Crossup(C,구));
valuewhen(1,단타==1 && 단타(1) == 0, 구 * 1.97 - 간)
----------------------------------------
3. 수식 B를 데드크로스하고, 당일 or 며칠 후 재돌파 할 때 검색
----------------------------------------
4. 60분봉에서 수식 C를 돌파할 때 검색
< 수식 C >
이동=ma(c,기간1);
평균=ma(c,기간2);
조건=crossup(이동,평균);
valuewhen(1,조건,(h+l)/비율1)
기간1 : 20
기간2 : 120
비율1 : 2.1
비율2 : 2.23
----------------------------------------
감사합니다!!
2025-07-20
404
글번호 192602