커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3396
글번호 230811
답변완료
수식 부탁드립니다
수고하십니다. 아래 조건에 맞는 수식 요청드립니다.
파라볼릭 af(0.02), maxAF(0.2);
-- 매수
. 최초 매수 파라볼릭 신호 발생시 매수 주문
. 1분봉 기준 현재 종가가 이전 봉의 종가보다 낮으면 청산
. 재 진입 안하고 다음 매수 파라볼릭 신호시 재 진입 (현재 매수 신호 -> 매도 신호 -> 다시 매수 신호가 나왔을때 진입)
-- 매도
. 최초 매도 파라볼릭 신호 발생시 매도 주문
. 1분봉 기준 현재 종가가 이전 봉의 종가보다 높으면 청산
. 재 진입 안하고 다음 매도 파라볼릭 신호시 재 진입 (현재 매도 신호 -> 매수 신호 -> 다시 매도 신호가 나왔을때 진입)
감사합니다.
2020-04-25
644
글번호 138355
수색대대 님에 의해서 삭제되었습니다.
2020-04-25
0
글번호 138354
답변완료
수식 부탁드립니다.
수식좀 부탁합니다.
data1: 1분봉
data2: 일봉(동종목)
data2(조건A)만족시 value5 = 5
data2(조건B)만족시 value5 = 10
각조건만족시 할당후 30일(30봉)간 유지
위 조건에서 최근30봉간 발생횟수
할당된 숫자의 합을 구하는 수식좀 부탁합니다.
2020-04-25
688
글번호 138353
새벽에 님에 의해서 삭제되었습니다.
2020-04-25
0
글번호 138352
답변완료
문의드립니다.
len = input(14, minval=1, title="DL")
lensig = input(14, title="AS", minval=1, maxval=50)
up = change(high)
down = -change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = rma(tr, len)
plus = fixnan(100 * rma(plusDM, len) / trur)
minus = fixnan(100 * rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
adx1 = input(15, title="WTr")
adx2 = input(25, title="MTr")
adx3 = input(40, title="STr")
ADXcolor= if adx < adx1
ADXcolor = color.gray
if adx >= adx1 and adx < adx2
ADXcolor := color.yellow
if adx >= adx2 and adx < adx3
ADXcolor := color.orange
if adx >= adx3
ADXcolor := color.red
DIAcolor = plus > minus ? color.lime : color.red
DIA = plus - minus
plot(DIA, color=DIAcolor, title="DI Average",style=plot.style_columns, linewidth=2)
plot(adx, color=ADXcolor, title="ADX",style=plot.style_circles, linewidth=2)
변환 문의드립니다. 감사합니다.
좋은 하루되세요
2020-04-24
783
글번호 138351
답변완료
종목검색식을 부탁합니다
첨부한 차트처럼 5일이동평균선이 10일이동평균선을 'a'처럼 겹쳣다가 올라가거나 'b'처럼 접근했다가 올라가는 종목을 검색하는 식을 부탁합니다. 물론 20일이동평균선은 그동안 상승해야겠죠. 자꾸만 부탁해서 죄송합니다.
2020-04-24
784
글번호 138350
답변완료
부탁드립니다
항상 감사드립니다
아래의 식을 다음의 조건으로 수정을 하고 싶습니다.
그럼 부탁 좀 드리겠습니다.
1. 수정: 최근 10 개(변수), (아래수식: 최근 5%의 개수)
2. 최근 10개의 R3의 값이 30 이하가 되면
"10개를 포함하여 누적으로 T3가 50 까지 도달"할때까지
■가 포함된 신호 (B■,S■)로 표현하고 싶습니다. (그림 및 3,4,5번에 설명)
"T3"값이 50까지 도달 되면 다시 B,S 으로 표시
3. "T3" : "10개를 포함"하여 누적 된 값
T3 = [(누적STrailing개수)/(누적SLoss+누적STrailing)개수] x100
R3의 값이 30 이하가 되면 R3의 값을 30으로 만들어준 10개를 포함하여
이후 청산되는 stoploss, stoptrailing 수를 누적시켜(10+1, 10+2, 10+3 ...)
T3 값을 만들고 싶습니다.
*R3 30 이하가 되고 T3가 50이 될때 까지는 R3 값은 무시
(T3가 50이 될때 까지 R3값에 의한 조건발생 없음)
(T3가 50 도달 이후에 최근 10개에 대한 R3값에 의해 조건 발생)
5. R3값 표시(검정): 아래수식 동일 (최근 10개에 대한 R3값 마지막 봉 표시)
T3값 표시(빨강): ■가 포함된 신호발생 후 청산(stoploss, stoptrailing) 다음 봉에
T3가 50이 될때 까지 만 표시
그럼 부탁드립니다.
input : 시작(30), 종료(50);
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false),tx1(0),cnt(0),sum(0);
var: Tcond(false),ht(0),lcnt(0),trcnt(0),R(-1);
Array : XX[200](-1);
var : tx3(0),cnt3(0),sum3(0),lcnt3(0),trcnt3(0),R3(-1), TR3(0), GR3(0);
Array : XX3[200](-1);
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 Tcond == true then
{
if marketposition == 0 and crossup(var1,var2) Then {
if Condition3 == true then ####
buy("B1■");
Else
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
if Condition3 == true then ####
sell("S1■");
Else
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
if Condition3 == true then ####
buy("B2■");
Else
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
if Condition3 == true then ####
sell("S2■");
Else
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
{
lcnt3 = lcnt3+1;
XX3[0] = 0;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if Floor((trcnt3+lcnt3)*(0.05)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.05))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3 + 1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.05))*100;
}
}
if IsExitName("StopTrailing",1) == true then
{
trcnt3 = trcnt3+1;
XX3[0] = 1;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if Floor((trcnt3+lcnt3)*(0.05)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.05))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3+1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.05))*100;
}
}
TR3 = trcnt3/(trcnt3+lcnt3)*100 ;
}
if R3 <= 시작 and R3[1] > 시작 Then
Condition3 = true;
if Condition3 == true
and R3 >= 종료 and R3[1] < 종료 Then
Condition3 = false;
Text_Delete(tx3);
tx3 = Text_New(NextBarSdate,NextBarStime,H,NumToStr(TR3,1)+NewLine+NumToStr(R3,1));
Text_SetSize(tx3,15);
Text_Setstyle(tx3,2,20);
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");
}
}
2020-04-27
799
글번호 138349
답변완료
문의드립니다. Cycle Identifier Indicator
안녕하세요.
MT4로 작성된 Cycle Identifier Indicator를 알게 되었는데, 가능한 간단한 예스트레이더 수식으로 변환할 수 있을까요?
감사합니다.
--------------------------------------------------------------------------------
//+------------------------------------------------------------------+
//| CycleIdentifier.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//----
#property indicator_separate_window
#property indicator_buffers 6
//----
#property indicator_color1 DarkGray
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 DarkGreen
#property indicator_color5 Brown
//----
#property indicator_minimum -1.2
#property indicator_maximum 1.2
//----
extern int PriceActionFilter=1;
extern int Length=3;
extern int MajorCycleStrength=4;
extern bool UseCycleFilter=false;
extern int UseFilterSMAorRSI=1;
extern int FilterStrengthSMA=12;
extern int FilterStrengthRSI=21;
//----
double LineBuffer[];
double MajorCycleBuy[];
double MajorCycleSell[];
double MinorCycleBuy[];
double MinorCycleSell[];
double ZL1[];
//----
double CyclePrice=0.0, Strength =0.0, SweepA=0.0, SweepB=0.0;
int Switch=0, Switch2=0, SwitchA=0, SwitchB=0, SwitchC=0, SwitchD=0, SwitchE=0, SwitchAA=0, SwitchBB=0;
double Price1BuyA=0.0, Price2BuyA=0.0;
int Price1BuyB=1.0, Price2BuyB=1.0;
double Price1SellA=0.0, Price2SellA=0.0;
int Price1SellB=0.0, Price2SellB=0.0;
bool ActiveSwitch=True, BuySwitchA=FALSE, BuySwitchB=FALSE, SellSwitchA=FALSE, SellSwitchB=FALSE;
int BuySellFac=01;
bool Condition1, Condition2, Condition3, Condition6;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,LineBuffer);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexBuffer(1,MajorCycleBuy);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,3);
SetIndexBuffer(2,MajorCycleSell);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
SetIndexBuffer(3,MinorCycleBuy);
SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,1);
SetIndexBuffer(4,MinorCycleSell);
SetIndexStyle(5,DRAW_NONE);
SetIndexBuffer(5,ZL1);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
SetIndexEmptyValue(3,0.0);
SetIndexEmptyValue(4,0.0);
SetIndexEmptyValue(5,0.0);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit() {return(0);}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
// if(counted_bars>0) counted_bars--;
// int position=Bars-1;
int position=Bars-counted_bars;
if (position<0) position=0;
//----
int rnglength=250;
double range=0.0, srange=0.0;
for(int pos=position; pos >=0; pos--)
{
srange=0.0;
int j=0;
for(int i=0;i<rnglength;i++)
{
j++;
int posr=pos + i;
if (posr>=Bars)
break;
srange=srange + (High[posr] - Low[posr]);
}
range=srange/j * Length;
int BarNumber=Bars-pos; //??????????
if (BarNumber < 0)
BarNumber=0;
CyclePrice=iMA(NULL, 0, PriceActionFilter, 0, MODE_SMMA, PRICE_CLOSE, pos);
if (UseFilterSMAorRSI==1)
ZL1[pos]=ZeroLag(CyclePrice,FilterStrengthSMA, pos);
if (UseFilterSMAorRSI==2)
ZL1[pos]=ZeroLag( iRSI(NULL, 0, 14, CyclePrice, FilterStrengthRSI ), FilterStrengthRSI, pos);
if (ZL1[pos] > ZL1[pos+1])
SwitchC=1;
if (ZL1[pos] < ZL1[pos+1])
SwitchC=2;
if (BarNumber<=1)
{
if (Strength==0)
SweepA =range;
else
SweepA=Strength;
Price1BuyA =CyclePrice;
Price1SellA =CyclePrice;
}
/* ***************************************************************** */
if (BarNumber > 1)
{
if (Switch > -1)
{
if (CyclePrice < Price1BuyA)
{
if (UseCycleFilter && (SwitchC==2) && BuySwitchA )
{
MinorCycleBuy[pos + BarNumber - Price1BuyB]=0; //MinorBuySell
LineBuffer[pos + BarNumber - Price1BuyB ]=0; //line
}
if (!UseCycleFilter && BuySwitchA)
{
MinorCycleBuy[pos +BarNumber - Price1BuyB]=0;
LineBuffer[pos +BarNumber - Price1BuyB]=0;
}
Price1BuyA=CyclePrice;
Price1BuyB=BarNumber;
BuySwitchA=TRUE;
}
else if (CyclePrice > Price1BuyA)
{
SwitchA=BarNumber - Price1BuyB;
if (!UseCycleFilter)
{
MinorCycleBuy[pos +SwitchA]=-1;//MinorBuySell - DarkGreen
LineBuffer[pos +SwitchA]=-1;//line
}
if (UseCycleFilter && SwitchC ==1)
{
MinorCycleBuy[pos +SwitchA]=-1; //MinorBuySell
LineBuffer[pos +SwitchA]=-1; //line
SwitchD=1;
}
else
{
SwitchD=0;
}
BuySwitchA=TRUE;
double cyclePrice1=iMA(NULL, 0, PriceActionFilter, 0, MODE_SMMA, PRICE_CLOSE, pos + SwitchA);
if (ActiveSwitch)
{
Condition1=CyclePrice - cyclePrice1>=SweepA;
}
else
{
Condition1=CyclePrice>=cyclePrice1 * (1 + SweepA/1000);
}
if (Condition1 && SwitchA>=BuySellFac)
{
Switch= - 1;
Price1SellA=CyclePrice;
Price1SellB=BarNumber;
SellSwitchA=FALSE;
BuySwitchA=FALSE;
}
}
}
if(Switch < 1)
{
if (CyclePrice > Price1SellA)
{
if (UseCycleFilter && SwitchC==1 && SellSwitchA )
{
MinorCycleSell[pos +BarNumber - Price1SellB]=0; //MinorBuySell
LineBuffer[pos +BarNumber - Price1SellB ]=0; //line
}
if (!UseCycleFilter && SellSwitchA )
{
MinorCycleSell[pos +BarNumber - Price1SellB]=0;//MinorBuySell
LineBuffer[pos +BarNumber - Price1SellB]=0;//line
}
Price1SellA=CyclePrice;
Price1SellB=BarNumber;
SellSwitchA=TRUE;
}
else if (CyclePrice < Price1SellA)
{
SwitchA=BarNumber - Price1SellB;
if (!UseCycleFilter)
{
MinorCycleSell[pos +SwitchA]=1; // MinorBuySell darkRed
LineBuffer[pos +SwitchA]=1; //"CycleLine"
}
if (UseCycleFilter && (SwitchC==2))
{
MinorCycleSell[pos +SwitchA]=1;//MinorBuySell darkRed
LineBuffer[pos +SwitchA]=1;//CycleLine
SwitchD =2;
}
else
SwitchD =0;
SellSwitchA=TRUE;
double cyclePrice2=iMA(NULL, 0, PriceActionFilter, 0, MODE_SMMA, PRICE_CLOSE, pos + SwitchA);
if (ActiveSwitch)
Condition1=(cyclePrice2 - CyclePrice)>=SweepA;
else
Condition1=CyclePrice<=(cyclePrice2 * (1 - SweepA/1000));
if (Condition1 && SwitchA>=BuySellFac)
{
Switch=1;
Price1BuyA=CyclePrice;
Price1BuyB=BarNumber;
SellSwitchA=FALSE;
BuySwitchA=FALSE;
}
}
}
}
LineBuffer[pos]=0;
MinorCycleBuy[pos]=0;
MinorCycleSell[pos]=0;
//----
if (BarNumber==1)
{
if (Strength==0)
SweepB =range * MajorCycleStrength;
else
SweepB=Strength * MajorCycleStrength;
Price2BuyA=CyclePrice;
Price2SellA=CyclePrice;
}
if (BarNumber > 1)
{
if (Switch2 > - 1)
{
if (CyclePrice < Price2BuyA)
{
if (UseCycleFilter && SwitchC==2 && BuySwitchB )
{
MajorCycleBuy [pos +BarNumber - Price2BuyB]=0; //MajorBuySell,green
// LineBuffer[pos + BarNumber - Price2BuyB ] = 0; //line -----
}
if (!UseCycleFilter && BuySwitchB )
{
MajorCycleBuy [pos +BarNumber - Price2BuyB]=0;//MajorBuySell,green
// LineBuffer[pos + BarNumber - Price2BuyB ] = 0; //line-----------
}
Price2BuyA=CyclePrice;
Price2BuyB=BarNumber;
BuySwitchB=TRUE;
}
else if (CyclePrice > Price2BuyA)
{
SwitchB=BarNumber - Price2BuyB;
if (!UseCycleFilter)
{
MajorCycleBuy [pos +SwitchB]=-1; //MajorBuySell green
// LineBuffer[pos + SwitchB] = -1; //line--------------
}
if (UseCycleFilter && SwitchC ==1)
{
MajorCycleBuy [pos +SwitchB]=-1; //MajorBuySell green
// LineBuffer[pos + SwitchB] = -1; //line-----------------
SwitchE =1;
}
else
SwitchE =0;
BuySwitchB=TRUE;
double cyclePrice3=iMA(NULL, 0, PriceActionFilter, 0, MODE_SMMA, PRICE_CLOSE, pos + SwitchB);
if (ActiveSwitch)
Condition6=CyclePrice - cyclePrice3>=SweepB;
else
Condition6=CyclePrice>=cyclePrice3 * (1 + SweepB/1000);
if (Condition6 && SwitchB>=BuySellFac)
{
Switch2= - 1;
Price2SellA=CyclePrice;
Price2SellB=BarNumber;
SellSwitchB=FALSE;
BuySwitchB=FALSE;
}
}
}
if (Switch2 < 1)
{
if (CyclePrice > Price2SellA )
{
if (UseCycleFilter && SwitchC ==1 && SellSwitchB )
{
MajorCycleSell [pos +BarNumber - Price2SellB]=0; //"MajorBuySell",red
// LineBuffer[pos + BarNumber - Price2SellB ] = 0; //line -----
}
if (!UseCycleFilter && SellSwitchB )
{
MajorCycleSell [pos +BarNumber - Price2SellB]=0;//"MajorBuySell",red
// LineBuffer[pos + BarNumber - Price2SellB ] = 0; //line -----
}
Price2SellA=CyclePrice;
Price2SellB=BarNumber;
SellSwitchB=TRUE;
}
else if (CyclePrice < Price2SellA)
{
SwitchB=BarNumber - Price2SellB ;
if (!UseCycleFilter)
{
MajorCycleSell[pos + SwitchB]=1; //"MajorBuySell",red
// LineBuffer[pos + SwitchB ] = 1; //line -----
}
if (UseCycleFilter && SwitchC ==2)
{
MajorCycleSell [pos + SwitchB]=1; //"MajorBuySell",red
// LineBuffer[pos + SwitchB ] = 1; //line -----
SwitchE =2;
}
else
SwitchE =0;
SellSwitchB=TRUE;
double cyclePrice4=iMA(NULL, 0, PriceActionFilter, 0, MODE_SMMA, PRICE_CLOSE, pos + SwitchB);
if (ActiveSwitch)
Condition6=cyclePrice4 - CyclePrice>=SweepB;
else
Condition6=CyclePrice<=cyclePrice4 * (1.0 - SweepB/1000.0);
if (Condition6 && SwitchB>=BuySellFac)
{
Switch2=1;
Price2BuyA=CyclePrice;
Price2BuyB=BarNumber;
SellSwitchB=FALSE;
BuySwitchB=FALSE;
}
}
}
}
LineBuffer[pos]=0;
MajorCycleSell[pos]=0;
MajorCycleBuy[pos]=0;
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double ZeroLag(double price, int length, int pos)
{
if (length < 3)
{
return(price);
}
double aa=MathExp(-1.414*3.14159/length);
double bb=2*aa*MathCos(1.414*180/length);
double CB=bb;
double CC=-aa*aa;
double CA=1 - CB - CC;
double CD=CA*price + CB*ZL1[pos+1] + CC*ZL1[pos+2];
return(CD);
}
//+------------------------------------------------------------------+
2020-04-24
1250
글번호 138348
답변완료
문의 드립니다.
캔들 수 설정에 따라 종가 청산 신호가 나오기도 하고
안 나오기도 하는 현상이 있어서 문의합니다.
보통 300캔들로 설정하고 매매 시작하는데요.
분명 전일 매매시 종가에 청산되었는데 아침 시작시에
청산신호(xab2)가 발생했습니다.
그래서 원인을 찾다가 보니 캔들 500개까지 했을 때는 아침 시작시에
청산신호 뜨고, 캔들 1000개로 했을 때는 정상적인 종가 청산으로
나왔습니다.
보통 매매시에 300캔들로 설정합니다.
종가 청산식은 아래처럼 했습니다.
if sdate != sdate[1] Then SetStopEndofday(045800);
참고로 첨부파일 첨부합니다.
2020-04-24
1007
글번호 138347