커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1587
글번호 230811
답변완료
좋은 주말 되십시요^^
* 주말인데 죄송하게 시스템 수식 하나만 요청 드립니다.
* 기준
ㅇ 5일 이평선이 20일 이평선을 크로스업 하면 매수(1계약)
- 수익이 50틱이면 청산
- 매수후 손실이면서 하이킨 아시 색상이 바뀌면 추가매수(1차 추가매수 2계약)
(매매 진입시 색상 기준 으로 바뀌는 기준임)
- 1차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 2차추가매수(4계약)
- 2차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 3차추가매수(8계약)
- 3차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 4차추가매수(16계약)
- 끝
혹시 이런 매매수식이 가능 할런지요 수식요청 좀 드림니다.
## 하이킨 아시 사용 수식
input : len(20),len2(20);
var : oo(0),cc(0),hh(0),ll(0),col(0);
var : haclose(0),haopen(0),hahigh(0),halow(0);
var : o2(0),h2(0),l2(0),c2(0);
oo=ema(open,len);
cc=ema(close,len);
hh=ema(high,len);
ll=ema(low,len);
haclose = (oo+hh+ll+cc)/4;
haopen = iff(IsNaN(haopen[1]) == true, (oo + cc)/2 , (haopen[1] + haclose[1]) / 2);
hahigh = max (hh, max(haopen,haclose));
halow = min (ll, min(haopen,haclose));
o2=ema(haopen, len2);
c2=ema(haclose, len2);
h2=ema(hahigh, len2);
l2=ema(halow, len2);
col=iff(o2>c2 , red , lime);
//PlotPaintBar(h2, l2,o2,c2, "heikin smoothed", col);
##============================================================================================================
##============================================================================================================
input : StartTime(080000),EndTime(220000);
var : Tcond(False);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
##============================================================================================================
##============================================================================================================
{
##============================================================================================================
## 매수식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and 수식요청 Then
{
Buy( "수");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
## 매도식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and 수식요청 Then
{
Sell( "도");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
}
##============================================================================================================
##============================================================================================================
## 매수 청산식
if MarketPosition == 1 then
{
ExitLong("수수익",AtLimit,EntryPrice+PriceScale*50);
ExitLong("수손절",AtStop,EntryPrice-PriceScale*60);
Exitlong("수80청",AtStop,highest(H,BarsSinceEntry)-PriceScale*80);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*0 Then Exitlong("수0프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*7.9);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*20 Then Exitlong("수2프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*1.0);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*40 Then Exitlong("수4프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.9);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then Exitlong("수5프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.7);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*70 Then Exitlong("수7프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.3);
}
##============================================================================================================
##============================================================================================================
## 매도 청산식
if MarketPosition == -1 then
{
ExitShort("도수익",AtLimit,EntryPrice-PriceScale*50);
ExitShort("도손절",AtStop,EntryPrice+PriceScale*60);
ExitShort("도80청",AtStop,highest(H,BarsSinceEntry)-PriceScale*80);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*0 Then ExitShort("도0프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*7.9);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*20 Then ExitShort("도2프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*1.0);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*40 Then ExitShort("도4프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.5);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then ExitShort("도5프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.5);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*70 Then ExitShort("도7프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.3);
}
##============================================================================================================
##============================================================================================================
SetStopEndofday(230000);
##============================================================================================================
##============================================================================================================
ㅇ 좋은 주말되십시요^^ 항상 많은 도움에 고맙습니다.
2025-03-10
443
글번호 188893
답변완료
수식변환
항상 수고 많으십니다.
트레이딩뷰에 있는 수식을 이용할수있도록 도움받고자 글 남깁니다.
변환 부탁드립니다.
************
study(title="CCI Divergences", format=format.price)
len = input(title="CCI Period", minval=1, defval=14)
src = input(title="CCI Source", defval=close)
lbR = input(title="Pivot Lookback Right", defval=5)
lbL = input(title="Pivot Lookback Left", defval=5)
rangeUpper = input(title="Max of Lookback Range", defval=60)
rangeLower = input(title="Min of Lookback Range", defval=5)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=false)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=false)
bearColor = color.red
bullColor = color.green
hiddenBullColor = color.green
hiddenBearColor = color.red
textColor = color.white
noneColor = color.new(color.white, 100)
osc = cci(src, len)
plot(osc, title="CCI", linewidth=2, color=color.yellow)
obLevel = hline(100, title="Overbought", linestyle=hline.style_dotted)
osLevel = hline(-100, title="Oversold", linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=color.gray, transp=80)
plFound = na(pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
bars = barssince(cond == true)
rangeLower <= bars and bars <= rangeUpper
alertcondition(osc[1] > 100.0 and osc[2] < 100.0, title="CCI value crosses over 100.0", message="Check charts for a CCI cross over 100.0")
alertcondition(osc[1] < 100.0 and osc[2] > 100.0, title="CCI value crosses under 100.0", message="Check charts for a CCI cross under 100.0")
alertcondition(osc[1] > -100. and osc[2] < -100.0, title="CCI value crosses over -100.0", message="Check charts for a CCI cross over -100.0")
alertcondition(osc[1] < -100.0 and osc[2] > -100.0, title="CCI value crosses under -100.0", message="Check charts for a CCI cross under -100.0")
//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low
oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
// Price: Lower Low
priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)
bullCond = plotBull and priceLL and oscHL and plFound
plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=2,
color=(bullCond ? bullColor : noneColor),
transp=0
)
plotshape(
bullCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish Label",
text=" Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor,
transp=0
)
alertcondition(bullCond, title="Regular bullish divergence in CCI found", message="Check charts for a regular bullish divergence found with CCI")
//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low
oscLL = osc[lbR] < valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
// Price: Higher Low
priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1)
hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound
plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish",
linewidth=2,
color=(hiddenBullCond ? hiddenBullColor : noneColor),
transp=0
)
plotshape(
hiddenBullCond ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish Label",
text=" H Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor,
transp=0
)
alertcondition(hiddenBullCond, title="Hidden bullish divergence in CCI found", message="Check charts for a hidden bullish divergence found with CCI")
//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High
oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
// Price: Higher High
priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)
bearCond = plotBear and priceHH and oscLH and phFound
plot(
phFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish",
linewidth=2,
color=(bearCond ? bearColor : noneColor),
transp=0
)
plotshape(
bearCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish Label",
text=" Bear ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor,
transp=0
)
alertcondition(bearCond, title="Regular bearish divergence in CCI found", message="Check charts for a regular bearish divergence found with CCI")
//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High
oscHH = osc[lbR] > valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
// Price: Lower High
priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1)
hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound
plot(
phFound ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bearish",
linewidth=2,
color=(hiddenBearCond ? hiddenBearColor : noneColor),
transp=0
)
plotshape(
hiddenBearCond ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bearish Label",
text=" H Bear ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor,
transp=0
)
alertcondition(hiddenBearCond, title="Hidden bearish divergence in CCI found", message="Check charts for a hidden bearish divergence found with CCI")
2025-03-07
481
글번호 188892
볼라레 님에 의해서 삭제되었습니다.
2025-03-07
0
글번호 188891
답변완료
수식으로 된다면 부탁드립니다
매물대 챠트의 막대가 10개로 나오게 할 방법이 있을까요?
행복한 하루 되세요
2025-03-07
401
글번호 188890
답변완료
종목 검색 시점에 대한 질문
안녕하세요! 매번 친절하고 자세한 답변 너무 감사드립니다.
종목 검색에 대해 이상한 부분이 있어서 질문드립니다.
일단 아래는 일봉 기준의 종목검색식입니다.
Input:period1(5),cnt(1);
var:;
Value1 = (ma(c,period1) - ma(c,period1)[cnt])/ma(c,period1)[cnt]*100;
if Volume[100] > 0
&& Money[1] > 10000000000
&& Value1[1] > 1.5 && Value1[1] > Value1[2]
&& AccumN(IFf(o < c[1]*1.15,1,0),5)[1] == 5
Then
Find(1);
해당 수식이 포함된 전략을 '오늘' 실행시키면 제가 기대하는 바는,
전일기준의 조건을 만족하는 종목들입니다. 그래서 조건 전부가 [1]을 첨부하고 있고요.
그런데, 이해가 안되는 점은 이 수식으로 종목검색을 수행하면, "장 중"에 검색 종목이
바뀐다는 점입니다. 분명 모든 값이 전일의 값을 기준으로 하고 있는데도 말이죠.
어느 부분을 제가 실수하고 있는지 도저히 모르겠습니다.시간되실때 답변 부탁드립니다...
2025-03-07
381
글번호 188889
당근인생 님에 의해서 삭제되었습니다.
2025-03-07
0
글번호 188888
답변완료
종목검색식 부탁드립니다
1. 단순이평 120선과 240선 사이에
있는 종목검색식 부탁드려요 (120선이상~240선이하)
2. 단순이평 120선과 240선 사이에있는 (120선이상~240선이하)
종목검색식 부탁드립니다
(단, 0봉전~30봉전까지 모든종목)
2025-03-07
413
글번호 188887
답변완료
문의 드립니다
안녕하세요
다음 코딩을 예스로 전환 부탁드립니다
length1 = input(14, minval=1)
length = input(22, minval=1)
ATR = rma(tr, length1)
Coef = input(3, minval=1)
HP(length) => highest(length)
plot(HP(length)-(ATR*Coef), color=red, title="Chandelier")
감사합니다
2025-03-07
436
글번호 188886
답변완료
수식요청
다=Min(
NPreDayLow(2),NPreDayLow(3),NPreDayLow(4),
NPreDayLow(5),NPreDayLow(6),NPreDayLow(7),
NPreDayLow(8),NPreDayLow(9),NPreDayLow(10),
NPreDayLow(11),NPreDayLow(12),NPreDayLow(13),
NPreDayLow(14),NPreDayLow(15),NPreDayLow(16));
바=Max(
NPreDayHigh(1),NPreDayHigh(2),NPreDayHigh(3),
NPreDayHigh(4),NPreDayHigh(5),NPreDayHigh(6),
NPreDayHigh(7),NPreDayHigh(8),NPreDayHigh(9),
NPreDayHigh(10),NPreDayHigh(11),NPreDayHigh(12),
NPreDayHigh(13),NPreDayHigh(14),NPreDayHigh(15));
스=CountSince(DayLow()<다,date!=date(1))==(기간-간격);
Valuewhen(1,스,바)
기간 15, 간격 3
위 수식은 60분봉에서 다바스박스 선을 긋는 것으로 입수한 것입니다.
이 선을 돌파하는 종목을 검색코저 합니다만,
우선 이 수식이 맞는 건지 아니면 다른 더 좋은 게 있는지요?
60분봉 돌파수식을 부탁드립니다.
(물론 예스랭귀지로 된 수식)
2025-03-09
417
글번호 188884