커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3183
글번호 230811
답변완료
지표수식 변환 요청드립니다
수식변환 요청드립니다.
아래수식은 트레이딩뷰 지표식인데 이미지파일 그림처럼 캔들로 구현하지 못하더라도
HARSI 바디 시가 종가 고가 저가 를 선으로 출력되어도 됩니다
##=======// //@version=5
//@author=JayRogers
indicator('Heikin Ashi RSI Oscillator', 'HARSI •', false, format.price, 2)
string TT_HARSI = 'Period for the RSI calculations used to generate the' + 'candles. This seperate from the RSI plot/histogram length.'
string TT_PBIAS = 'Smoothing feature for the OPEN of the HARSI candles.' + '
Increases bias toward the prior open value which can' + ' help provide better visualisation of trend strength.' + '
** By changing the Open values, High and Low can also' + ' be distorted - however Close will remain unchanged.'
string TT_SMRSI = 'This option smoothes the RSI in a manner similar to HA' + ' open, but uses the realtime rsi rather than the prior' + ' close value.'
///////////////////////////////////////////////////////////////////////
// //
// ====== INPUTS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// -- Candle config
string GROUP_CAND = 'Config » HARSI Candles'
i_lenHARSI = input.int(14, 'Length', group=GROUP_CAND, minval=1, tooltip=TT_HARSI)
i_smoothing = input.int(7, 'Open Smoothing', group=GROUP_CAND, minval=1, maxval=100, tooltip=TT_PBIAS)
string INLINE_COL = 'Colour Pallette'
i_colUp = input.color(color.red, 'Colour Pallette  ', group=GROUP_CAND, inline=INLINE_COL)
i_colDown = input.color(color.teal, ' ', group=GROUP_CAND, inline=INLINE_COL)
i_colWick = input.color(color.gray, ' ', group=GROUP_CAND, inline=INLINE_COL)
// -- RSI plot config
string GROUP_PLOT = 'Config » RSI Plot'
i_source = input.source(ohlc4, 'Source', group=GROUP_PLOT)
i_lenRSI = input.int(7, 'Length', group=GROUP_PLOT, minval=1)
i_mode = input.bool(true, 'Smoothed Mode RSI?', group=GROUP_PLOT, tooltip=TT_SMRSI)
////////////////////////////////////////////////////////////////////////////////
// //
// ====== FUNCTIONS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// zero median rsi helper function, just subtracts 50.
f_zrsi(_source, _length) =>
ta.rsi(_source, _length) - 50
// mode 셀렉타블 rsi function for standard, or smoothed output
f_rsi(_source, _length, _mode) =>
// get base rsi
float _zrsi = f_zrsi(_source, _length)
// smoothing in a manner similar to HA open, but rather using the realtime
// rsi in place of the prior close value.
var float _smoothed = na
_smoothed := na(_smoothed[1]) ? _zrsi : (_smoothed[1] + _zrsi) / 2
// return the requested mode
_mode ? _smoothed : _zrsi
// RSI Heikin-Ashi generation function
f_rsiHeikinAshi(_length) =>
// get close rsi
float _closeRSI = f_zrsi(close, _length)
// emulate "open" simply by taking the previous close rsi value
float _openRSI = nz(_closeRSI[1], _closeRSI)
// the high and low are tricky, because unlike "high" and "low" by
// themselves, the RSI results can overlap each other. So first we just go
// ahead and get the raw results for high and low, and then..
float _highRSI_raw = f_zrsi(high, _length)
float _lowRSI_raw = f_zrsi(low, _length)
// ..make sure we use the highest for high, and lowest for low
float _highRSI = math.max(_highRSI_raw, _lowRSI_raw)
float _lowRSI = math.min(_highRSI_raw, _lowRSI_raw)
// ha calculation for close
float _close = (_openRSI + _highRSI + _lowRSI + _closeRSI) / 4
// ha calculation for open, standard, and smoothed/lagged
var float _open = na
_open := na(_open[i_smoothing]) ? (_openRSI + _closeRSI) / 2 : (_open[1] * i_smoothing + _close[1]) / (i_smoothing + 1)
// ha high and low min-max 섹렉션
float _high = math.max(_highRSI, math.max(_open, _close))
float _low = math.min(_lowRSI, math.min(_open, _close))
// return the OHLC values
[_open, _high, _low, _close]
////////////////////////////////////////////////////////////////////////////////
// //
// ====== SERIES, LINES and LABELS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// standard, or ha smoothed rsi for the line plot and/or histogram
float RSI = f_rsi(i_source, i_lenRSI, i_mode)
// get OHLC values to use in the plotcandle()
[O, H, L, C] = f_rsiHeikinAshi(i_lenHARSI)
// candle body colouring
color bodyColour = C > O ? i_colUp : i_colDown
color wickColour = i_colWick
// make our HA rsi candles
plotcandle(O, H, L, C, 'HARSI', bodyColour, wickColour, bordercolor=bodyColour)
2022-12-18
1726
글번호 164663
답변완료
지표문의에요.
아래 키움수식을 예스수식으로 변환부탁드려요,,
라인 색이랑 두께도 지정 가능하게 부탁드려요,,
미리 감사드립니다. (__)
지표1 선행중심선(상단지표)
수식1
a=Highest(H,period1);
b=LowEst(L,period1);
N=(A+B)/2;
shift(N,26)
수식2
a=Highest(H,period2);
b=LowEst(L,period2);
N=(A+B)/2;
shift(N,26)
수식3
a=Highest(H,period3);
b=LowEst(L,period3);
N=(A+B)/2;
shift(N,26)
수식4
a=Highest(H,period4);
b=LowEst(L,period4);
N=(A+B)/2;
shift(N,26)
수식5
a=Highest(H,period5);
b=LowEst(L,period5);
N=(A+B)/2;
shift(N,26)
지표조건
period1 333
period2 555
period3 777
period4 888
period5 999
지표2 볼벤중심선(하단지표)
수식1
BBandsUp(Period1,D1)
수식2
BBandsUp(Period2,D1)
수식3
BBandsUp(Period3,D1)
수식4
a=Highest(H,period4);
b=LowEst(L,period4);
N=(A+B)/2;
shift(N,26)
수식5
MA(c, 기간6, 이평종류)
지표조건
period1 999
period2 777
period3 555
period4 333
D1 2
기간6 1
이평종류 지수
2022-12-17
1108
글번호 164662
답변완료
문의드립니다
input : signal(10);
var1 = OBV;
Var2 = Ema(var1,signal);
Plot1(Var1);
plot2(Var2);
수고 많으십니다
여전에 만들어주신 지표입니다
부탁드릴 수식은
1) Plot1이 Plot2보다 위면 빨간색
아래면 파란색 으로 표시돼게 나오도록 부탁드립니다
색깔 변경 가능하도록 부탁드리겠습니다
2) 위 지표를 시스템으로 부탁드리겠습니다
2022-12-16
1124
글번호 164660
답변완료
수정부탁드립니다
색상을 실시간 으로 표시부탁드립니다.
input : vPeriod(120),선두께(2),N(0),rtt(20),상승색a(magenta),하락색a(lime),색상두께(20),글씨대(20);
Var:상승색(Magenta), 하락색(Cyan);
input : 틱1(0),틱2(1);
Var:vj(0),vT(0),txx(0),txxx(0);
Var: date11(0),date12(0),time11(0),time12(0),sTL1(0),sTL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),stx(0),stx1(0),stl4(0),sTL9(0),dboxx(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0);
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
#Heiken Ashi 시고저종
if index == 0 then
{
xOpen = open;
xClose = (O+H+L+C)/4;
xHigh = MaxList( high, xOpen, xClose);
xLow = MinList( low, xOpen,xClose);
}
else
{
xClose = (O+H+L+C)/4;
xOpen = (xOpen [1] + xClose [1])/2 ;
xHigh = MaxList(High, xOpen, xClose) ;
xLow = MinList(Low, xOpen, xClose) ;
}
if XClose > Xopen Then
PlotPaintBar(h,l,"강조",Red);
else if XClose < Xopen Then
PlotPaintBar(h,l,"강조",Blue);
else
PlotPaintBar(h,l,"강조",GREEN);
r[0] = 0;
r[1] = 2;
r[2] = 3.;
r[3] = -1;
r[4] = -2.;
r[5] = 1;
r[6] = 0.5;
For vj = 0 To 19
{
HiBar[vj] = HiBar[vj] + 1;
LoBar[vj] = LoBar[vj] + 1;
}
if crossup(xClose,highest(xHigh,vPeriod)[1]) Then
vT = 1;
if CrossDown(xClose,Lowest(xLow,vPeriod)[1]) Then
vT = -1;
If vT == -1 Then
{
If vT[1] != -1 Then
{
For vj = 18 DownTo 0
{
LoVal[vj+1] = LoVal[vj];
LoBar[vj+1] = LoBar[vj];
}
LoVal[0] = xLow;
LoBar[0] = 0;
date11 = date[HiBar[0]+N];
time11 = stime[HiBar[0]+N];
Value11 = HiVal[0];
date12 = date[LoBar[0]+N];
time12 = stime[LoBar[0]+N];
Value12 = LoVal[0];
Text_Delete(txx);
TL_Delete(stl);
sTL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
sTL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(sTL1,하락색);
date21 = date[HiBar[0]+N];
time21 = stime[HiBar[0]+N];
date22 = date[0];
time22 = stime[0];
for vj = 0 to 6
{
fr[vj] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[vj]);
}
// Condition99 = True;
Txx = Text_New(date11,time11,Value11+PriceScale*7,"●"+NewLine+NewLine+NewLine);
Text_SetColor(Txx,Blue);
Text_SetStyle(Txx,2,2);
Text_SetSize(txx,rtt);
dboxx = box_new(Date11,Time11,xHigh,NextBarSdate,NextBarStime,xLow);
Box_SetColor(dboxx,하락색a);
Box_SetFill(dboxx,true,색상두께);
Box_SetExtFill(dboxx,true);
if Condition99 == true and Loval[0] <= loval[1]-PriceScale*틱2 Then
{
Condition99 = False;
Text_Delete(txx);
}
if abs(value11[1]-value12[1]) < 1 Then
Text_Delete(txxx);
Else
{
Text_SetColor(Txxx,magenta);
Text_SetSize(txxx,글씨대);
}
txxx = Text_New(date11,time11,Value11,NumToStr(abs(value11-value12),2));
Text_SetStyle(txxx,2,1);
Text_SetBold(txxx,1);
}
If LoVal[0] > xLow Then
{
LoVal[0] = xLow;
LoBar[0] = 0;
date12 = date[LoBar[0]+N];
time12 = stime[LoBar[0]+N];
Value12 = LoVal[0];
TL_SetEnd(sTL1, date12,time12,Value12);
date22 = date[0+N];
time22 = stime[0+N];
if Condition99 == true and Loval[0] <= loval[1]-PriceScale*틱2 Then
// PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
{
Condition99 = False;
Text_Delete(txx);
}
Text_SetString(txxx,NumToStr(abs(value11-value12),2));
if abs(value11-value12) < 1 Then
{
Text_SetColor(Txxx,Blue);
Text_SetSize(txxx,글씨대);
}
Else
{
Text_SetColor(Txxx,Blue);
Text_SetSize(txxx,15);
}
Box_SetEnd(dboxx,NextBarSdate,NextBarStime,L);
}
}
If vT == 1 Then
{
If vT[1] != 1 Then
{
For vj = 18 DownTo 0
{
HiVal[vj+1] = HiVal[vj];
HiBar[vj+1] = HiBar[vj];
}
HiVal[0] = xHigh;
HiBar[0] = 0;
date11 = date[LoBar[0]+N];
time11 = stime[LoBar[0]+N];
Value11 = LoVal[0];
date12 = date[HiBar[0]+N];
time12 = stime[HiBar[0]+N];
Value12 = HiVal[0];
Text_Delete(txx);
TL_Delete(stl);
sTL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
sTL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(sTL1,상승색);
date31 = date[LoBar[0]+N];
time31 = stime[LoBar[0]+N];
date32 = date[0];
time32 = stime[0];
for vj = 0 to 5
{
fr[vj] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[vj]);
}
//Condition1 = False;
Txx = Text_New(date11,time11,Value11+PriceScale*7,NewLine+NewLine+NewLine+"●");
// Condition99 = True;
Text_SetColor(Txx,magenta);
Text_SetStyle(Txx,2,2);
Text_SetSize(txx,rtt);
dboxx = box_new(Date11,Time11,xHigh,NextBarSdate,NextBarStime,xLow);
Box_SetColor(dboxx,상승색a);
Box_SetFill(dboxx,true,색상두께);
Box_SetExtFill(dboxx,true);
if Condition99 == true and Loval[0] >= Loval[1]-PriceScale*틱1 Then
{
Condition99 = False;
Text_Delete(txx);
}
if abs(value11[1]-value12[1]) < 1 Then
Text_Delete(txxx);
Else
{
Text_SetColor(Txxx,Blue);
Text_SetSize(txxx,글씨대);
}
txxx = Text_New(date11,time11,Value11,NumToStr(abs(value11-value12),2));
Text_SetStyle(txxx,2,3);
Text_SetBold(txxx,1);
}
If HiVal[0] < xhigh Then
{
HiVal[0] = xHigh;
HiBar[0] = 0;
date12 = date[HiBar[0]+N];
time12 = stime[HiBar[0]+N];
Value12 = HiVal[0];
TL_SetEnd(sTL1, date12,time12,Value12);
date32 = date[0+N];
time32 = stime[0+N];
if Condition99 == true and HiVal[0] <= HiVal[1]-PriceScale*틱2 Then
// PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
{
Condition99 = False;
Text_Delete(txx);
}
Text_SetString(txxx,NumToStr(abs(value11-value12),2));
if abs(value11-value12) < 1 Then
{
Text_SetColor(Txxx,magenta);
Text_SetSize(txxx,글씨대);
}
Else
{
Text_SetColor(Txxx,magenta);
Text_SetSize(txxx,15);
}
Box_SetEnd(dboxx,NextBarSdate,NextBarStime,xlow);
}
}
TL_SetSize(sTL1,선두께);
사각박스지표 선행지표 부탁드립니다.
선행지표
Input:a(9),b(26),d(52);
var : 전환선(0),기준선(0),후행스팬(0),선행스팬1(0),선행스팬2(0),선행스팬3(0),선행스팬4(0);
전환선 = (highest(H,1)+lowest(L,1))/2;
기준선 = (highest(H,b)+lowest(L,b))/2;
후행스팬 = C;
선행스팬1 = (전환선+기준선)/2;
선행스팬2 = (highest(H,d)+lowest(L,d))/2;
if 전환선 >= C then
Plot1(전환선, "전환선",blue);
Else
Plot1(전환선, "전환선",RED);
if 기준선 >= C then
Plot2(기준선, "기준선",BLUE);
Else
Plot2(기준선, "기준선",red);
Plot3(후행스팬, "후행스팬");
if 선행스팬1 >= C then
Plot4(선행스팬1, "선행스팬1",BLUE);
Else
Plot4(선행스팬1, "선행스팬1",RED);
if 선행스팬2 >= C then
Plot5(선행스팬2, "선행스팬2",BLUE);
Else
Plot5(선행스팬2, "선행스팬2",RED);
2022-12-17
992
글번호 164659
흑수돌 님에 의해서 삭제되었습니다.
2022-12-16
9
글번호 164658
흑수돌 님에 의해서 삭제되었습니다.
2022-12-16
14
글번호 164657
답변완료
수식 문의
아래의 강조 수식을 시그널로 변환하되
음봉이 연속해서 n회 출현하면 매도,
양봉이 연속해서 n회 출현하면 매수
하는 조건을 추가하고 싶습니다.
감사합니다.
input : gamma(0);
var : OSeries(0),ol0(0),ol1(0),ol2(0),ol3(0),ol(0);
var : CSeries(0),cl0(0),cl1(0),cl2(0),cl3(0),cl(0);
OSeries = Open;
IF BarIndex == 0 THEN
{
OL = OSeries;
ol0 = OSeries;
ol1 = OSeries;
ol2 = OSeries;
ol3 = OSeries;
}
ELSE
{
ol0 = (1 - gamma) * OSeries + gamma * ol0;
ol1 = -gamma * ol0 + ol0 + gamma * ol1;
ol2 = -gamma * ol1 + ol1 + gamma * ol2;
ol3 = -gamma * ol2 + ol2 + gamma * ol3;
OL = (ol0 + 2 * ol1 + 2 * ol2 + ol3) / 6;
}
CSeries = c;
IF BarIndex == 0 THEN
{
CL = CSeries;
cl0 = CSeries;
cl1 = CSeries;
cl2 = CSeries;
cl3 = CSeries;
}
ELSE
{
cl0 = (1 - gamma) * CSeries + gamma * cl0;
cl1 = -gamma * cl0 + cl0 + gamma * cl1;
cl2 = -gamma * cl1 + cl1 + gamma * cl2;
cl3 = -gamma * cl2 + cl2 + gamma * cl3;
CL = (cl0 + 2 * cl1 + 2 * cl2 + cl3) / 6;
}
#PlotPaintBar(h,l,ol,cl,"강조",IFf(cl>ol,RGB(255,130,36),RGB(126,210,255)));
PlotPaintBar(h,l,"강조",IFf(cl>ol,RGB(255,130,36),RGB(126,210,255)));
2022-12-19
1124
글번호 164656
답변완료
수식 문의
아래의 수식에서
설정된 시간값에만 지표가 작동하도록
수식을 만들고 싶습니다.
예컨데,
090000~160000으로 입력하면,
그 시간에만 지표& 시그널이 작동하고,
160000~090000까지는 지표값이 멈춰있다가,
090000 시간의 값부터 다시 받아 반영하는 것입니다.
해외선물에서 지표& 시그널을
본장의 움직임만 반영코자 함입니다.
감사합니다.
Input : shortPeriod(12), longPeriod(26), Vector(14), Period(9), n(50);
Var : MACDv(0), MACDsig(0), macdosc(0), rsi_(0), rsi_signal(0) ;
rsi_ = RSI(Period);
rsi_signal = MA(RSI(Period), Vector);
MACDv = Data2(MACD(shortPeriod, longPeriod));
//MACDsig = Data2(ema(MACDv,Period));
MACDsig = Data2(ema(Data2(MACD(shortPeriod, longPeriod)),Period));
//macdosc = Data2(MACDv-ema(MACDv,Period));
macdosc = Data2(Data2(MACD(shortPeriod, longPeriod))-ema(Data2(MACD(shortPeriod, longPeriod)),Period));
//MessageLog("%f %f %f", rsi_, rsi_signal, macdosc);
if macdosc > 0 && rsi_ < n && rsi_ > rsi_signal && rsi_[1] < rsi_signal[1] Then
{
Buy();
}
else if macdosc < 0 && rsi_ > n && rsi_ < rsi_signal && rsi_[1] > rsi_signal[1] Then
{
Sell();
}
2022-12-19
1475
글번호 164655
답변완료
수식하나 부탁합니다
매수조건 ) 5일선 우상향, 20일선 우상향, 캔들-5-20 정배열인 상태에서
캔들이 120선보다 위에 있으면 매수 진입
매도조건 ) 5일선 우하향, 20일선 우하향, 캔들-5-20 역배열인 상태에서
캔들이 120선보다 아래에 있으면 매도 진입
신규진입) 포지션이 아무것도 없을때 매수 또는 매도 조건 만족시 1계약 진입
매수청산) 1계약이 매수 진입된 포지션에서 매도조건 만족시 2계약 매도진입
(1계약 매수청산 및 1계약 매도진입이 동시에 발생)
매도청산) 1계약이 매도 진입된 포지션에서 매수조건 만족시 2계약 매수진입
(1계약 매도청산 및 1계약 매수진입이 동시에 발생)
손절) 모든 경우에 손절 25포인트
시점) 캔들 완성시점이 아니라 조건만족시 즉시 실행
2022-12-18
1122
글번호 164654