커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1610
글번호 230811
답변완료
슈퍼 트렌드
안녕하세요?
게시판 검색을 통해보니 슈퍼트렌드 지표가 있어 사용해보려고 합니다.
그런데 수식 자체가 상당히 길어서 지표하나를 쓰려고 하면 그런데로 사용하겠지만
다중이동평균선처럼 여러개 사용하려면 난감합니다.
그래서 이 지표식을 함수화하여 주시면 감사하겠습니다.
예를들어 ma(c,10) 처럼
supertrend(factor, AtrPeriod) 이렇게만 표현해도
supertrend 지표를 사용할 수 있도록 해 주세요
관련 지표수식 (게시판 내용 78035)
[지표식]
input : factor(3), AtrPeriod(10);
var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0);
if CurrentBar > 1 Then {
src = (H+L)/2;
// ATR계산(ATR 계산시 지수가중이동평균(rma)이용)
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 C > superTrend Then {
Plot1(superTrend,"UpTrend", Pink, 0, 5);
NoPlot(2);
}
Else {
Plot2(superTrend,"DnTrend", green, 0, 5);
NoPlot(1);
}
이상입니다.
2022-12-03
1162
글번호 164326
답변완료
이거 되나요?
5분봉 5이평이 20이평 위에 있고 1분봉 5-20골든크로스 시 매수
2022-12-03
920
글번호 164325
답변완료
수식부탁드림니다
input : Period(60),dv(2);
Input : 당일수익틱수(100);
var : BBup(0),BBmd(0),BBdn(0);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then
Xcond = true;
}
BBup = BollBandUp(Period,dv);
BBmd = ma(c,Period);
BBdn = BollBandDown(Period,dv);
if Xcond == false then
{
if MarketPosition >= 0 and C > bbup and C < O Then
Sell();
if MarketPosition <= 0 and C < bbdn and C > O Then
Buy();
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
안녕하세요
위식에서 추가 부탁드립니다
macd 오실레이터(12.26.9) 적용
양선 매수
음선 매도
2022-12-03
1306
글번호 164324
답변완료
식수정
input : P1(5),P2(20);
Input : short(12), long(26), signal(9);
input : BBP(20),dv(2);
input : StartTime(80000),EndTime(30000);
var : mav1(0),mav2(0),bbup(0),bbdn(0);
Var : MACDv(0), MACDs(0),macdo(0),T(0);
var : Tcond(false);
mav1 = ma(C,P1);
mav2 = ma(C,P2);
MACDv = MACD(short, long);
MACDs = ema(MACDv,signal);
macdo = MACDv-MACDs;
bbup = BollBandUp(BBP,dv);
bbdn = BollBandDown(BBP,dv);
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;
T = 0;
var1 = 0;
Var2 = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if Tcond == true Then
{
var1 = var1+v;
Var2 = Var2+1;
Var3 = var1/Var2;
if C < DayOpen and mav1 < mav1[1] Then
T = 1;
if T == 1 and
MACDO > 0 and
mav2 > mav2[1] Then
{
if (CrossUp(c,DayOpen) and C < BBup) or
(C > DayOpen and C > bbup and CrossDown(C,mav1)) Then
Buy();
}
if C > DayOpen and mav1 > mav1[1] Then
T = -1;
if T == -1 and
MACDO < 0 and
mav2 < mav2[1] Then
{
if (CrossDown(c,DayOpen) and C > BBdn) or
(C < DayOpen and C < bbdn and CrossUp(C,mav1)) Then
Sell();
}
if MarketPosition == 1 Then
{
# if CrossDown(C,DayOpen) Then
# ExitLong();
# if v >= Var3[1]*5 then
# ExitLong();
}
if MarketPosition == -1 Then
{
# if CrossUp(C,DayOpen) Then
# ExitShort();
# if v >= Var3[1]*5 then
# ExitShort();
}
}
SetStopProfittarget(3.0,PercentStop);
SetStopLoss(1.8,PercentStop);
안녕하세요
위 식에서
식추가 부탁드립니다.
익절.손절기능 삭제(SetStopProfittarget(3.0,PercentStop);
SetStopLoss(1.8,PercentStop);)
추가 매수 당일 시가선위에서 매수 진입후
시가선 아래로 하향시 손절후 바로 매도 전환.
매도 당일 시가선아래서 매도 진입후
당일 시가선위로 상승시 손절후 바로 매수 진입전환.
2022-12-03
1520
글번호 164323
답변완료
문의
아래는 이평선을 터치했을 때 라인이 생기는 지표인데
이 지표를 3분봉에 설정하든 10분봉에 설정하든 무조건 5분봉의 이평선이 기준이 되도록 부탁드립니다. 예를 들면 3분봉에 이 지표를 설정했을 때 5분봉의 5,10,20,60,120 이평선을 터치시 라인이 생기도록 하고 싶습니다. 감사합니다.
input : P1(5), P2(10), P3(20), P4(60), P5(120);
var1 = ma(C,P1);
Var2 = ma(C,p2);
Var3 = ma(C,p3);
Var4 = ma(C,p4);
var5 = ma(C,p5);
if (h >= var1 and H[1] < var1[1]) or (L <= var1 and L[1] > var1[1]) Then
{
value1 = var1;
}
if (h >= var2 and H[1] < var2[1]) or (L <= var2 and L[1] > var2[1]) Then
{
value2 = Var2;
}
if (h >= var3 and H[1] < var3[1]) or (L <= var3 and L[1] > var3[1]) Then
{
value3 = Var3;
}
if (h >= var4 and H[1] < var4[1]) or (L <= var4 and L[1] > var4[1]) Then
{
value4 = Var4;
}
if (h >= var5 and H[1] < var5[1]) or (L <= var5 and L[1] > var5[1]) Then
{
value5 = Var5;
}
if value1 > 0 Then
Plot1(value1);
if value2 > 0 Then
Plot2(value2);
if value3 > 0 Then
Plot3(value3);
if value4 > 0 Then
Plot4(value4);
if value5 > 0 Then
Plot5(value5);
2022-12-03
1072
글번호 164322
답변완료
부탁 드립니다
도움에 감사 드립니다.
for .....to 를 사용 하여 간락히 부탁 드립니다.
input : P(10);
var : count(0),cnt(0);
var1 = ma(c,P);
Var99=
iff(var1[1]>var1,1,0)+
iff(var1[2]>var1,1,0)+
iff(var1[3]>var1,1,0)+
iff(var1[4]>var1,1,0)+
iff(var1[5]>var1,1,0)+
iff(var1[6]>var1,1,0)+
iff(var1[7]>var1,1,0)+
iff(var1[8]>var1,1,0)+
iff(var1[9]>var1,1,0)+
iff(var1[10]>var1,1,0)+
'+
'+
'+
iff(var1[P]>var1,1,0);
2022-12-03
893
글번호 164321
답변완료
청산신호발생했음에도 잔고에 남은수량 처리 방법
주식 현물거래하려는데..
5회차 분할매수중.
3회차까지 분할 매수하다가..
청산(매도) 신호가 모두 동시에 떠서 신호상으로는 모두 청산된것으로 차트에는 표시됩니다.
그러나, 1회차 물량(또는 일부만) 만 청산주문이 들어가고..나머지는 가격조건이 급락으로 인해 맞지않아 주문이 들어가지 않아서,
결국 사람이 수동으로 시장가 또는 지정가로 전량 청산했습니다.
이럴경우,
청산신호가 모두 발생했으면 계좌잔고에는 수량이 남아있지않아야하는데,
청산가격 조건이 순간적인 요인(급락 등)이 맞지않아 잔량이 남는경우....
수량이나 또는 잔고 잔량등을 체크해서 남아있는 물량을 모두 지정가 또는 시장가로 자동 청산할수 있는 방법이 있나요?
if Marketposition == 0 and 계좌잔고 수량 > 0 then ;포지션이 무포지션일때 잔고수량이 있으면. 시장가매도
Sell(시장가) ;
대충 이런흐름이 될거같은데요..ㅠㅠ
2022-12-02
1031
글번호 164320
답변완료
질문 드립니다.
지수가 특정 조건 만족시 파생상품에 대한 종가매매를 하고 싶은데요.
실제 시스템으로는 동시호가 매매가 지원되지 않는 것으로 알고 있습니다.
대안책으로 전략실행차트에 일봉 onclose로 전략을 경보후 주문으로 설정하고
금액 0원 계좌에 실행시키게 되면 15시 30분에 매수 충족 여부를 경보로 띄워주는가요?
이때 경보가 뜨면 이를 바탕으로 선물 동시호가 시간에 매수를 하려고 합니다.
답변 부탁드립니다.
2022-12-02
1193
글번호 164319
답변완료
시스템식부탁드립니다
아래의 지표수식을 활용하여
지표[1]
( 타주기(15분) a < b or 타주기(5분) a < b ) and 현주기 a < b 이면 매수
( 타주기(15분) a > b or 타주기(5분) a > b ) and 현주기 a > b 이면 매도
#####
지표[2]
( 타주기(15분) dir == 1 or 타주기(5분) dor == 1 ) and 현주기 ▲ 이면 매수
( 타주기(15분) dir == -1 or 타주기(5분) dir == -1 ) and 현주기 ▼ 이면 매도
//수식도움부탁드립니다.
/////////지표[1]
input : lengthh(22),k(true),gain(0.7);
var : Price(0),hma(0),hma3(0),a(0),b(0),clr(0);
var : kf1(0),dk1(0),smooth1(0),velo1(0),x1(0),g1(0);
var : kf2(0),dk2(0),smooth2(0),velo2(0),x2(0),g2(0);
price = (h+l)/2;
hma = wma((2 * wma(price, lengthh / 2)) - wma(price, lengthh), round(sqrt(lengthh),0));
hma3= wma(wma(c, (lengthh/2)/3)*3 - wma(c, (lengthh/2)/2) - wma(c, (lengthh/2)), (lengthh/2));
x1 = hma;
g1 = gain;
kf1 = 0.0;
dk1 = x1 - iff(isnan(kf1[1]) == False,kf1[1], x1);
smooth1 = iff(isnan(kf1[1]) == False,kf1[1], x1)+dk1*sqrt(g1*2);
velo1 = 0.0;
velo1 = iff(isnan(velo1[1]) == False,velo1,0) + (g1*dk1);
kf1 = smooth1+velo1;
x2 = hma3;
g2 = gain;
kf2 = 0.0;
dk2 = x2 - iff(isnan(kf2[1]) == False,kf2[1], x2);
smooth2 = iff(isnan(kf2[1]) == False,kf2[1], x2)+dk2*sqrt(g2*2);
velo2 = 0.0;
velo2 = iff(isnan(velo2[1]) == False,velo2,0) + (g2*dk2);
kf2 = smooth2+velo2;
a = iff(k == true, kf1 , hma);
b = iff(k == true, kf2 , hma3);
clr = iff(b > a , red , lime);
Plot1(kf1,"a",clr);
Plot2(kf2,"b",clr);
//////////
////////지표[2]
input : length(2),mult(2),useClose(true),크기(25);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(1),longcolor(plum),shortcolor(lightblue),tx(0);
atrv = mult * atr(length);
longStop = IFf(useClose , highest(close, length) , highest(h,length)) - atrv;
longStopPrev = longStop[1];
longStop = iff(close[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = IFf(useClose , lowest(close, length) , lowest(L,length)) + atrv;
shortStopPrev = shortStop[1];
shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(close > shortStopPrev , 1 ,iff( close < longStopPrev , -1 , dir));
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
if dir == 1 and dir[1] == -1 Then
{
tx = Text_New(sDate,sTime,longStop,"▲");
Text_SetStyle(tx,2,0);
Text_SetSize(tx, 크기);
Text_SetColor(tx,longcolor);
}
if dir == -1 and dir[1] == 1 Then
{
tx = Text_New(sDate,sTime,shortStop,"▼");
Text_SetStyle(tx,2,1);
Text_SetSize(tx, 크기);
Text_SetColor(tx,shortcolor);
}
//////////////
수고하세요
2022-12-04
1128
글번호 164318