커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3751
글번호 230811
답변완료
문의드립니다.
1.
xcolor = iff(pos == -1 ,red,iff(pos == 1 , green,blue));
plot1(xATRTrailingStop,"Trailing Stop",xcolor);
상기식에서
색상과 굵기를 속성창에서 조절가능하다면 부탁합니다.
혹,속성창에서 안된다면 굵기를 조절할수있게 부탁합니다.
2.
5일 이평과 20일이평의
골든크로스일때와 데드크로스일때를 막대그래프로 표현하고싶습니다.
골든일때 빨강, 데드일때 파랑으로 막대그래프로 표현할수있게 부탁합니다.
2020-04-09
944
글번호 137720
답변완료
부탁드립니다.
항상 감사드립니다.
아래와 같이 ##카운트를 추가하고 싶습니다.
1) 전략창 전체의: [(StopTrailing 개수) / (StopLoss+StopTrailing) 개수] x100
2) 청산시점 포함하여 최근 20% 개수에 대한 : [(StopTrailing 개수) / (StopLoss+StopTrailing) 개수] x100
예_1
전체 청산 개수 20개(StopTrailing 10개, StopLoss 10개)
최근20% 청산개수 4개(StopTrailing 1개, StopLoss 3개)
1) 전체 개수(20개)= 11010101001010110001 --> 수식 : [10개/(10개+10개)]x100 = 50.0
2) 20% 개수(4개)= 0001 --> 수식 : [1개/(1개+3개)]x100 = 25.0
예_2
전체 청산 개수 25개(StopTrailing 13개, StopLoss 12개)
최근20% 청산개수 5개(StopTrailing 2개, StopLoss 3개)
1) 전체 개수(25개) = 1101011010101001010110001 --> 수식 : [13/(13+12)]x100 = 52.0
2) 20% 개수(5개) = 10001 --> 수식 : [2/(2+3)]x100 = 40.0
(StopTrailing:1, StopLoss:0로 표현)
1),2)를 텍스트 표시하고 싶습니다.
텍스트는 1)이 위 2)는 아래에 위치하게 부탁드립니다.
1)값(위)
2)값(아래)
값은 소수 한자리 수까지 표현 부탁드립니다.
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond(false),ht(0);
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
tt = 0;
X = false;
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = false;
if MarketPosition == 1 Then
{
ExitLong("BE6");
}
if MarketPosition == -1 Then
{
ExitShort("SE6");
}
}
if Tcond == true then
{
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
}
## 카운트 (수정요청)
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
tt = tt +1 ;
if tt > ht Then
{
ht = tt;
}
Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 1;
ht = tt;
}
Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
}
2020-04-09
1013
글번호 137715
답변완료
문의드립니다.
66867 관련하여 답변주셔서 감사드립니다. 답변 주신 변환식에
plot(Signal_Line, title = "Signal", color = color.gray, style = plot.style_line)
을 추가하고 싶습니다.
plot3(Signal_Line,"Signal", GRAY); 로 단순히 추가 작성하여 컴파일 시켜보았지만 적용이 원래대로 되지 않습니다.
추가 수정 문의드립니다. 감사합니다.
------------------------------------------------------------------------------
(기존 답변 문의드렸던 수식입니다.)
> //@version=4
study(BB MACD)
inp_Source = input(title = "Source", type = input.source, defval = close)
inp_Sensitivity = input(title = "Sensitivity", type = input.float, defval = 0.01)
inp_HiLo_Lookback = input(title = "Hi/Lo Lookback", type = input.integer, defval = 5)
inp_Slow_MA_Period = input(title = "Slow MA: Period", type = input.integer, defval = 26)
inp_Slow_MA_Method = input(title = "Slow MA: Type", defval = 'EMA', options = ['SMA', 'EMA', 'LWMA', 'RMA'])
inp_Fast_MA_Period = input(title = "Fast MA: Period", type = input.integer, defval = 12)
inp_Fast_MA_Method = input(title = "Fast MA: Type", defval = 'EMA', options = ['SMA', 'EMA', 'LWMA', 'RMA'])
inp_Signal_MA_Period = input(title = "Signal MA: Period", type = input.integer, defval = 9)
inp_Signal_MA_Method = input(title = "Signal MA: Type", defval = 'SMA', options = ['SMA', 'EMA', 'WMA', 'RMA'])
f_Get_MA(MA_Type, MA_Source, MA_Period) =>
MA = 0.0
MA := MA_Type == 'SMA' ? sma(MA_Source, MA_Period) : MA_Type == 'EMA' ? ema(MA_Source, MA_Period) : MA_Type == 'WMA' ? wma(MA_Source, MA_Period) : MA_Type == 'RMA' ? rma(MA_Source, MA_Period) : na
MA
f_Get_Std_Dev(MA_Type, MA_Source, MA_Period) =>
MA = 0.0
MA := f_Get_MA(MA_Type, MA_Source, MA_Period)
Price = 0.0
Price := sma(MA_Source, 1)
Summation = 0.0
for i = 0 to MA_Period - 1
Summation := Summation + (Price[i] - MA) * (Price[i] - MA)
Std_Dev = 0.0
Std_Dev := sqrt(Summation / MA_Period)
Std_Dev
f_Get_TR() =>
TR = max(high, close[1]) - min(low, close[1])
TR
f_Get_ATR(Period) =>
TR = f_Get_TR()
Summation = 0.0
for i = 1 to Period
Summation := Summation + TR[i]
ATR = 0.0
ATR := Summation / Period
ATR
MA_Fast = f_Get_MA(inp_Fast_MA_Method, inp_Source, inp_Fast_MA_Period)
HiLo_Range = abs(barssince(high == highest(high, inp_HiLo_Lookback)) - barssince(low == lowest(low, inp_HiLo_Lookback))) * syminfo.mintick * 100000
MA_Slow = f_Get_MA(inp_Slow_MA_Method, inp_Source, inp_Slow_MA_Period)
MA_Slow_Deviation = f_Get_Std_Dev(inp_Slow_MA_Method, inp_Source, inp_Slow_MA_Period)
MA_Slow_ATR = f_Get_ATR(inp_Slow_MA_Period)
Histogrm = MA_Slow_Deviation - MA_Slow_ATR
Main_Line = Histogrm
Signal_Line = f_Get_MA(inp_Signal_MA_Method, Main_Line, inp_Signal_MA_Period)
Histogrm_Color = color.green
if MA_Fast >= MA_Fast[1]
if HiLo_Range >= inp_Sensitivity
Histogrm_Color := color.green
else
Histogrm_Color := color.yellow
else
if HiLo_Range >= inp_Sensitivity
Histogrm_Color := color.red
else
Histogrm_Color := color.blue
plot(Histogrm, title = "BB MACD", color = Histogrm_Color, style = plot.style_histogram)
plot(Histogrm, title = "BB MACD", color = color.blue, style = plot.style_line)
plot(Signal_Line, title = "Signal", color = color.gray, style = plot.style_line)
2020-04-08
1226
글번호 137712
답변완료
누적패수
누적패수 3회까지만 거래하는 조건 부탁합니다.
*******************************************************************************
Input : Period1(74),Period2(12);
Var : 매수이평(0), 매도이평(0);
매수이평 = ma(bids, period1);
매도이평 = ma(asks, period2);
if crossup(매수이평, 매도이평) then
buy();
2020-04-08
1108
글번호 137710
답변완료
시스템 트레이딩에 적용할 매수, 매도 수식 작성요청
언제나 노고가 많으신 관계자 분들께 항상 감사드립니다.
분봉챠트 및 틱봉챠트에 적용할 아래의 시스템매매 수식 작성을 부탁드립니다.
<매수조건>
현재 캔들이 당일의 고가와 저가의 평균가 이상으로 양봉마감시 다음 캔들 시가에서 매수.
<메도조건>
현재 캔들이 당일의 고가와 저가의 평균가 이하로 음봉마감시 다음 캔들 시가에서 매도.
감사합니다.
2020-04-08
1042
글번호 137709
레전드 님에 의해서 삭제되었습니다.
2020-04-08
4
글번호 137708
답변완료
감사합니다
N봉전 120분 60분 30분 15분봉 저가라인 부탁합니다
몇일 저 만들어주신 녀월주일봉 저가라인 수식에 timelow를 넣어 변형 해보다
잘안돼서 또 이렇게 부탁드립니다 감사합니다
2020-04-08
872
글번호 137706
chun0711 님에 의해서 삭제되었습니다.
2020-04-08
0
글번호 137704
답변완료
문의드립니다.
study(title="DM", shorttitle="D", overlay=false)
lc = input(17.5185, title="Long Cycle")
sc =input(8.3896, title="Short Cycle")
sp =input(9.0503, title="Signal Length")
src=input(close, title="Source")
fs = nz(fs[1]) + 2.0 / (1.0 + sc) * (src- nz(fs[1]))
ss = nz(ss[1]) + 2.0 / (1.0 + lc) * (src - nz(ss[1]))
r = fs - ss
s = nz(s[1]) + 2.0/(1 + sp)*(r - nz(s[1]))
plot(r, style=columns, color=r>0?green:red, transp=80, title="Histo")
plot(s, color=teal, linewidth=2, title="DM")
변환 문의드립니다. 감사합니다.
2020-04-08
938
글번호 137696