커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3178
글번호 230811
kortp119 님에 의해서 삭제되었습니다.
2022-12-08
16
글번호 164426
답변완료
수식 문의드립니다.
당일 분봉차트에서 전일 저가를 터치하면 1번 매수신호
전일저가 -1% 를 터치하면 2번 매수신호
전일저가 -2% 를 터치하면 3번 매수신호
전일저가 -3% 를 터치하면 4번 매수신호
총 4개의 신호를 청산신호는 없게 구현하고 싶습니다.
당일 총 4개의 매수신호는 당일에 한해서 각각 1번씩만 나오게하고 중복신호 없음
신호가 없는 날은 신호 안나오게 패스 다음날에 조건에 만족하면 신호 발생하게
만들고 싶습니다.
만드니까 자꾸 당일 중복신호가 나오네요
당일 청산신호를 안쓰니까 구현하기가 어려워서 부탁드립니다.
2022-12-08
596
글번호 164425
답변완료
지표 수정
45344번알람제거부탁드립니다
2022-12-08
870
글번호 164424
답변완료
문의 드립니다.
input:length(5),a틱(20),b틱(20),c틱(5);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0);
Array:HH[10,2](0),LL[10,2](0);
input : StartTime(100000),EndTime(60000);
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);
}
}
process = 0;
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If LL[1,1] > L Then process = -1;
If HH[1,1] < H Then process = 1;
}
Else If Highest(H,length) == H and lastHiVal <> H Then process = 1;
Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1;
If process == 1 Then
{
T = 1;
lastHiVal = H;
If HH[1,2] < LL[1,2] Then
{
For j = 10 DownTo 2
{
HH[j,1] = HH[j-1,1];
HH[j,2] = HH[j-1,2];
}
}
If HH[1,2] < LL[1,2] or HH[1,1] < H Then
{
HH[1,1] = H;
HH[1,2] = Index;
sBar = Index - LL[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if LL[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 1);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2));
Text_SetStyle(Text1, 2, 1);
}
Text_SetStyle(Text1, 2, 1);
}
if MarketPosition <= 0 and
HH[2,1] >= LL[2,1]+PriceScale*a틱 and
LL[1,1] <= HH[2,1]-PriceScale*b틱 and
Tcond == true Then
Buy("b",AtStop,HH[2,1]+PriceScale*c틱);
}
If process == -1 Then
{
T = -1;
lastLoVal = L;
If LL[1,2] < HH[1,2] Then
{
For j = 10 DownTo 2
{
LL[j,1] = LL[j-1,1];
LL[j,2] = LL[j-1,2];
}
}
If LL[1,2] < HH[1,2] or LL[1,1] > L Then
{
LL[1,1] = L;
LL[1,2] = Index;
sBar = Index - HH[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if HH[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
}
if MarketPosition >= 0 and
LL[2,1] <= HH[2,1]-PriceScale*a틱 and
HH[1,1] >= LL[2,1]+PriceScale*b틱 and
Tcond == true Then
Sell("s",AtStop,LL[2,1]-PriceScale*c틱);
}
위 수식어에서 buy,sell 진입신호후 손실이 15틱이 나면 반대 포지션으로
전환하는 수식어를 추가 할 수 있을까요 ?
2022-12-08
860
글번호 164423
답변완료
수식도움 부탁드립니다.
아래수식에서 타주기 5분은 어떤 오류가 있는지 출력이 되지 않는데,
점검 부탁드립니다.
15분/1분은 정상출력됨
///////////
input : 분1(15),분2(5),length(1),mult(2),useClose(true);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : ATrv2(0),longStop2(0),longStopprev2(0),shortStop2(0),shortStopPrev2(0);
var : dir(1),dir1(0), dir2(1),dir21(0);;
var : truehighv(0),TrueLowv(0),hsatr(0) ;
var : truehighv2(0),TrueLowv2(0),hsatr2(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0);
var : xClose2(0),xOpen2(0),xHigh2(0),xLow2(0);
var : xClose12(0),xOpen12(0),xHigh12(0),xLow12(0);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),ii(0),ii2(0);
var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0);
var : sum2(0),longStop12(0),shortStop12(0),hv2(0),lv2(0);
var : longcolor(Crimson),shortcolor(Blue),tx(0);
Array : TrueRangev[100](0),AccumValue[100](0);
Array : TrueRangev2[100](0),AccumValue2[100](0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[100](0);
Array : oo2[100](0),hh2[100](0),ll2[100](0),cc2[100](0),hsc2[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
///
TF1 = TM%분1;
TF2 = TM%분2;
///
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and 분1 > 1 and TM >= TM[1]+분1) or
(Bdate == Bdate[1] and 분1 == 1 and TM > TM[1]) Then
{
ii = ii +1;
For cnt = 99 DownTo 1
{
TrueRangev[cnt] = TrueRangev[cnt-1];
oo[cnt] = oo[cnt-1];
hh[cnt] = hh[cnt-1];
ll[cnt] = ll[cnt-1];
cc[cnt] = cc[cnt-1];
hsc[cnt] = hsc[cnt-1];
AccumValue[cnt] = AccumValue[cnt-1];
}
AccumValue[0] = AccumValue[0]+1;
oo[0] = o;
hh[0] = h;
ll[0] = l;
Xopen1 = xopen[1];
Xhigh1 = xhigh[1];
Xlow1 = xlow[1];
Xclose1 = xclose[1];
longStop1 = longStop[1];
ShortStop1 = shortStop[1];
dir1 = dir[1];
var1 = 0;
var2 = 0;
}
if hh[0] > 0 and h > hh[0] Then
hh[0] = h;
if ll[0] > 0 and l < ll[0] Then
ll[0] = l;
cc[0] = c;
if ii == 1 then
{
xOpen = oo[0];
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xHigh = MaxList(hh[0], xOpen, xClose);
xLow = MinList(ll[0], xOpen,xClose);
}
else
{
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xOpen = (xOpen1 + xClose1)/2 ;
xHigh = MaxList(hh[0], xOpen, xClose) ;
xLow = MinList(ll[0], xOpen, xClose) ;
}
hsc[0] = xclose ;
if ii > 1 Then
{
If xClose1 > xHigh then
TrueHighv = xClose1;
else
TrueHighv = xHigh;
If xClose1 < xLow then
TrueLowv = xClose1;
else
TrueLowv = xLow;
TrueRangev[0] = TrueHighv - TrueLowv;
}
if ii > 2 Then
{
if TrueRangev[length-1] > 0 Then
{
sum = 0;
For cnt = 0 to length-1
{
sum = sum + TrueRangev[cnt];
}
hsatr = sum/length;
}
atrv = mult * hsatr;
hv = 0;
lv = 0;
For cnt = 0 to length-1
{
if useClose == true Then
{
if hv == 0 or (hv > 0 and hsc[cnt] > hv) Then
hv = hsc[cnt];
if lv == 0 or (lv > 0 and hsc[cnt] < lv) Then
lv = hsc[cnt];
}
Else
{
if hv == 0 or (hv > 0 and hh[cnt] > hv) Then
hv = hh[cnt];
if lv == 0 or (lv > 0 and ll[cnt] < lv) Then
lv = ll[cnt];
}
}
longStop = hv - atrv;
longStopPrev = longStop1;
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = lv + atrv;
shortStopPrev = shortStop1;
shortStop = iff(hsc[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(hsc[0] > shortStopPrev , 1 ,iff(hsc[0] < longStopPrev , -1 , dir1));
}
######
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and 분2 > 1 and TM >= TM[1]+분2) or
(Bdate == Bdate[1] and 분2 == 1 and TM > TM[1]) Then
{
ii2 = ii2 +1;
For cnt = 99 DownTo 1
{
TrueRangev2[cnt] = TrueRangev2[cnt-1];
oo2[cnt] = oo2[cnt-1];
hh2[cnt] = hh2[cnt-1];
ll2[cnt] = ll2[cnt-1];
cc2[cnt] = cc2[cnt-1];
hsc2[cnt] = hsc2[cnt-1];
AccumValue2[cnt] = AccumValue2[cnt-1];
}
AccumValue2[0] = AccumValue2[0]+1;
oo2[0] = o;
hh2[0] = h;
ll2[0] = l;
Xopen2 = xopen12[1];
Xhigh2 = xhigh12[1];
Xlow2 = xlow12[1];
Xclose2 = xclose12[1];
longStop12 = longStop2[1];
ShortStop12 = shortStop2[1];
dir21 = dir2[1];
var3 = 0;
var4 = 0;
}
if hh2[0] > 0 and h > hh2[0] Then
hh2[0] = h;
if ll2[0] > 0 and l < ll2[0] Then
ll2[0] = l;
cc2[0] = c;
if ii2 == 1 then
{
xOpen2 = oo2[0];
xClose2 = (oo2[0]+hh2[0]+ll2[0]+cc2[0])/4;
xHigh2 = MaxList(hh2[0], xOpen2, xClose2);
xLow2 = MinList(ll2[0], xOpen2,xClose2);
}
else
{
xClose2 = (oo2[0]+hh2[0]+ll2[0]+cc2[0])/4;
xOpen2 = (xOpen12 + xClose12)/2 ;
xHigh2 = MaxList(hh[0], xOpen2, xClose2) ;
xLow2 = MinList(ll[0], xOpen2, xClose2) ;
}
hsc2[0] = xclose2 ;
if ii2 > 1 Then
{
If xClose12 > xHigh2 then
TrueHighv2 = xClose12;
else
TrueHighv2 = xHigh2;
If xClose12 < xLow2 then
TrueLowv2 = xClose12;
else
TrueLowv2 = xLow2;
TrueRangev2[0] = TrueHighv2 - TrueLowv2;
}
if ii2 > 2 Then
{
if TrueRangev2[length-1] > 0 Then
{
sum2 = 0;
For cnt = 0 to length-1
{
sum2 = sum2 + TrueRangev2[cnt];
}
hsatr2 = sum2/length;
}
atrv2 = mult * hsatr2;
hv2 = 0;
lv2 = 0;
For cnt = 0 to length-1
{
if useClose == true Then
{
if hv2 == 0 or (hv2 > 0 and hsc2[cnt] > hv2) Then
hv2 = hsc2[cnt];
if lv2 == 0 or (lv2 > 0 and hsc2[cnt] < lv2) Then
lv2 = hsc2[cnt];
}
Else
{
if hv2 == 0 or (hv2 > 0 and hh2[cnt] > hv2) Then
hv2 = hh2[cnt];
if lv2 == 0 or (lv2 > 0 and ll2[cnt] < lv2) Then
lv2 = ll2[cnt];
}
}
longStop2 = hv2 - atrv2;
longStopPrev2 = longStop12;
longStop2 = iff(hsc2[1] > longStopPrev2 , max(longStop2, longStopPrev2) , longStop2);
shortStop2 = lv2 + atrv2;
shortStopPrev2 = shortStop12;
shortStop2 = iff(hsc2[1] < shortStopPrev2 , min(shortStop2, shortStopPrev2) , shortStop2);
dir2 = iff(hsc2[0] > shortStopPrev2 , 1 ,iff(hsc2[0] < longStopPrev2 , -1 , dir21));
}
}
///////////////
var : ATrvv(0),lS(0),lSprev(0),sS(0),sSPrev(0);
var : hscv(0),dirv(1);
var : th(0),TL(0),TRv(0),hsatrv(0) ;
var : xC(0),xO(0),xH(0),xL(0);
if index == 0 then
{
xO = open;
xC = (O+H+L+C)/4;
xH = MaxList( high, xO, xC);
xL = MinList( low, xO,xC);
}
else
{
xC = (O+H+L+C)/4;
xO = (xO[1] + xC[1])/2 ;
xH = MaxList(High, xO, xC) ;
xL = MinList(Low, xO, xC) ;
}
////////
If xC[1] > xH then
TH = xC[1];
else
TH = xH;
If xC[1] < xL then
TL = xC[1];
else
TL = xL;
TRv = TH - TL;
hsatrv = ma(TRv,length);
hscv = xC;
atrvv = mult * hsatrv;
lS = IFf(useClose , highest(hscv, length) , highest(xH,length)) - atrvv;
lSPrev = lS[1];
lS = iff(hscv[1] > lSPrev , max(lS, lSPrev) , lS);
sS = IFf(useClose , lowest(hscv, length) , lowest(xL,length)) + atrvv;
sSPrev = sS[1];
sS = iff(hscv[1] < sSPrev , min(sS, sSPrev) , sS);
dirv = iff(hscv > sSPrev , 1 ,iff(hscv < lSPrev , -1 , dirv));
/////////////////
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
//////////////
IF dirv == 1 Then
{
plot3(lS,"1분Long Stop",plum);
NoPlot(4);
}
Else
{
NoPlot(3);
plot4(sS,"1분Short Stop",lime);
}
//////
IF dir2 == 1 Then
{
plot5(longStop2 ,"5분Long Stop",orange);
NoPlot(6);
}
Else
{
NoPlot(5);
plot6(shortStop2,"5분Short Stop",Cyan);
}
2022-12-08
804
글번호 164422
답변완료
수식부탁합니다
그림처럼 a지점이 TL13 이기도 하고 TL12이기도 합니다
새로운TL13이 발생하든 아니든 한 변수로 리턴하고 싶습니다
1.저[1,1]과 저[2,1] 사이의 캔들 중 가장 큰 고가를 Pinkline 으로 리턴 가능할까요?
2.다른 방벙이 있다면 그 또한 부탁합니다.
3.답 좀....
if MarketPosition == 1 매수포지션
if MarketPosition == -1 매도포지션
if MarketPosition == 0 무포지션
if MarketPosition <= 0 ?
if MarketPosition >= 0 ?
4.crossdown(mav5,mav20) and c<redline
이 조건이 하나의 캔들로 완성이 되면 작동이 안되는지요?
감사합니다~
input:length(6);
Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""),
TL1(0),Text1(0),TL2(0),TL3(0),TL4(0),TL5(0),TL12(0),TL13(0),TL14(0),TL15(0),T(0),고점변곡(""),저점변곡("");
var : clr1(0),clr2(0),BE(0),SE(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
HH = IFF(0==1,C,H);
LL = IFF(0==1,C,L);
If Index == 0 Then
{
고[1,1] = HH;
저[1,1] = LL;
}
Condition1 = Highest(HH,length) == HH and 최종고가 <> HH;
Condition2 = Lowest (LL,length) == LL and 최종저가 <> LL;
처리구분 = "";
If Condition1 and Condition2 Then // 기간고점과 기간저점 동시 발생
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
#==========================================#
If 처리구분 == "고점처리" Then
{
T = 1;
최종고가 = HH; // 신규고점을 체크하기 위해 저장
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
If 1 == 1 Then
{
Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2));
Text_SetStyle(Text1, 0, 1);
Text_SetColor(Text1,Red);
}
TL_SetSize(TL1,1);
TL_SetColor(TL1,Gray);
}
Else If 고[1,1] < HH Then // 1번 고점보다 높은 고가 출현
{
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]);
// 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임
If 1 == 1 Then
{
Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text1,NumToStr(고[1,1],2));
}
}
최종꼭지점 = "고점";
}
#==========================================#
If 처리구분 == "저점처리" Then
{
T = -1;
최종저가 = LL;
If 최종꼭지점 == "고점" then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
If 1 == 1 Then
{
Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2));
Text_SetStyle(Text1, 0, -1);
Text_SetColor(Text1,Blue);
}
TL_SetSize(TL1,1);
TL_SetColor(TL1,Gray);
}
Else If 저[1,1] > LL then
{
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]);
If 1 == 1 Then
{
Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text1,NumToStr(저[1,1],2));
}
}
최종꼭지점 = "저점";
}
if T == -1 and T[1] != -1 Then
{
TL12 = TL_New(고[2,3],고[2,4],고[2,1],sdate,stime,고[2,1]);
TL_Delete(TL13);
TL13 = TL_New(고[1,3],고[1,4],고[1,1],Sdate,Stime,고[1,1]);
TL_SetExtRight(TL13,true);
TL_SetSize(TL13,2);
TL_SetColor(TL12,clr1);
TL_SetSize(TL12,2);
clr1 = Pink;
TL_SetColor(TL13,Pink);
}
if T == 1 and T[1] != 1 Then
{
TL14= TL_New(저[2,3],저[2,4],저[2,1],sdate,stime,저[2,1]);
TL_Delete(TL15);
TL15= TL_New(저[1,3],저[1,4],저[1,1],sdate,stime,저[1,1]);
TL_SetExtRight(TL15,true);
TL_SetColor(TL14,clr2);
TL_SetSize(TL14,2);
clr2 = LightBlue;
TL_SetColor(TL15,clr2);
TL_SetSize(TL15,2);
}
2022-12-11
866
글번호 164421
답변완료
문의드립니다
특정일이후 5일간의
dayhigh 의 평균값
daylow 의 평균값을 구하는 식 부탁합니다
감사합니다
2022-12-08
950
글번호 164420
답변완료
문의드립니다
indicator("Nadaraya-Watson Envelope [LuxAlgo]",overlay=true,max_bars_back=1000,max_lines_count=500,max_labels_count=500)
length = input.float(500,'Window Size',maxval=500,minval=0)
h = input.float(8.,'Bandwidth')
mult = input.float(3.)
src = input.source(close,'Source')
up_col = input.color(#39ff14,'Colors',inline='col')
dn_col = input.color(#ff1100,'',inline='col')
disclaimer = input(false, 'Hide Disclaimer')
//----
n = bar_index
var k = 2
var upper = array.new_line(0)
var lower = array.new_line(0)
lset(l,x1,y1,x2,y2,col)=>
line.set_xy1(l,x1,y1)
line.set_xy2(l,x2,y2)
line.set_color(l,col)
line.set_width(l,2)
if barstate.isfirst
for i = 0 to length/k-1
array.push(upper,line.new(na,na,na,na))
array.push(lower,line.new(na,na,na,na))
//----
line up = na
line dn = na
//----
cross_up = 0.
cross_dn = 0.
if barstate.islast
y = array.new_float(0)
sum_e = 0.
for i = 0 to length-1
sum = 0.
sumw = 0.
for j = 0 to length-1
w = math.exp(-(math.pow(i-j,2)/(h*h*2)))
sum += src[j]*w
sumw += w
y2 = sum/sumw
sum_e += math.abs(src[i] - y2)
array.push(y,y2)
mae = sum_e/length*mult
for i = 1 to length-1
y2 = array.get(y,i)
y1 = array.get(y,i-1)
up := array.get(upper,i/k)
dn := array.get(lower,i/k)
lset(up,n-i+1,y1 + mae,n-i,y2 + mae,up_col)
lset(dn,n-i+1,y1 - mae,n-i,y2 - mae,dn_col)
if src[i] > y1 + mae and src[i+1] < y1 + mae
label.new(n-i,src[i],'▼',color=#00000000,style=label.style_label_down,textcolor=dn_col,textalign=text.align_center)
if src[i] < y1 - mae and src[i+1] > y1 - mae
label.new(n-i,src[i],'▲',color=#00000000,style=label.style_label_up,textcolor=up_col,textalign=text.align_center)
cross_up := array.get(y,0) + mae
cross_dn := array.get(y,0) - mae
alertcondition(ta.crossover(src,cross_up),'Down','Down')
alertcondition(ta.crossunder(src,cross_dn),'Up','Up')
//----
var tb = table.new(position.top_right, 1, 1
, bgcolor = #35202b)
if barstate.isfirst and not disclaimer
table.cell(tb, 0, 0, 'Nadaraya-Watson Envelope [LUX] Repaints'
, text_size = size.small
, text_color = #cc2f3c)
위수식을(엔벨로프) 예스트레이드수식의로 변경부탁드립니다
미리감사드립니다~~
2022-12-07
1163
글번호 164419
답변완료
피라미딩2
buy1 , buy2 , buy3
3개의 포지션을 시간 간격으로 개별진입시,
아래의 함수들은 3개포지션의 평균가 평단가로 관리되나요?
아니면 자동으로 3개의 포지션이 각각 개별관리되나요?
SetStopProfittarget(익절,PointStop);
SetStoploss(손절,PointStop);
SetStopTrailing(손실범위 , 최소이익 , PointStop);
2022-12-07
952
글번호 164418