커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

문의 드립니다.~~~~

조건식1에서 수익또는 손실이 연속 n회 나는 것을 조건으로 조건식2가 실행되게 하는 방법은 어떻게 하나요?
프로필 이미지
예스요
2022-12-11
1333
글번호 164498
시스템
답변완료

수식도움 부탁드립니다.

////////////트레이딩뷰 원 수식 //Heiken Ashi Candles data = heikenashi(tickerid) resLT = input(title="Res LT", type=resolution, defval="D") resMT = input(title="Res MT", type=resolution, defval="240") LTo = security(data, resLT, open) LTc = security(data, resLT, close) MTo = security(data, resMT, open) MTc = security(data, resMT, close) LTlong = LTc > LTo LTshort = LTc < LTo MTema20 = ema(MTc,20) MTema20delta= change(MTema20) MTlong = MTc > MTo and MTc > MTema20 and MTema20delta > 0 MTshort = MTc < MTo and MTc < MTema20 and MTema20delta < 0 Long = MTlong and LTlong Short = MTshort and LTshort plot(Long ? 1 : Short ? -1: 0, title="TrendAlert", color= Long ? lime : Short ? red : gray, style=columns ) ############ ////////////// 제가 변환 해본 수식 # 변환하는데 잘 몰라서 오류가 있는 듯한데 #점검 부탁드립니다. //////////////// input : 분1(60),분2(15),period(20); 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 : xClose21(0),xOpen21(0),xHigh21(0),xLow21(0); var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),ii(0),ii2(0); var : sum(0), mav(0),mavdelta(0); var : TrendAlert(0); Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0); Array : oo2[100](0),hh2[100](0),ll2[100](0),cc2[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; ///15분 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 { oo[cnt] = oo[cnt-1]; hh[cnt] = hh[cnt-1]; ll[cnt] = ll[cnt-1]; cc[cnt] = cc[cnt-1]; } oo[0] = o; hh[0] = h; ll[0] = l; Xopen1 = xopen[1]; Xhigh1 = xhigh[1]; Xlow1 = xlow[1]; Xclose1 = xclose[1]; } 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) ; } #####5분 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 { oo2[cnt] = oo2[cnt-1]; hh2[cnt] = hh2[cnt-1]; ll2[cnt] = ll2[cnt-1]; cc2[cnt] = cc2[cnt-1]; } oo2[0] = o; hh2[0] = h; ll2[0] = l; Xopen21 = xopen2[1]; Xhigh21 = xhigh2[1]; Xlow21 = xlow2[1]; Xclose21 = xclose2[1]; } 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 ii == 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 = (xOpen21 + xClose21)/2 ; xHigh2 = MaxList(hh2[0], xOpen2, xClose2) ; xLow2 = MinList(ll2[0], xOpen2, xClose2) ; } if CC2[period-1] > 0 then { sum = 0; for cnt = 0 to period-1 { sum = sum+CC[cnt]; } mav = sum/period; mavdelta = mav - mav[1]; } } if xclose > xopen and xclose2 > xopen2 and xclose2 > mav and mavdelta > 0 Then TrendAlert = 1 ; if xclose < xopen and xclose2 < xopen2 and xclose2 < mav and mavdelta < 0 Then TrendAlert = -1 ; if trendalert == 1 Then Plot1(TrendAlert,"TrendAlert",orange); if trendalert == -1 Then Plot1(TrendAlert,"TrendAlert",green);
프로필 이미지
당일선물
2022-12-12
1517
글번호 164497
지표
답변완료

부탁 드립니다

도움에 감사 드립니다. 그림과 같이 부탁 드립니다.
프로필 이미지
yes
2022-12-11
1517
글번호 164496
지표
답변완료

잘 부탁드립니다

input : n1(10),n2(21),obLevel1(60),obLevel2(53),osLevel1(-60),osLevel2(-53); var : ap(0),esa(0),dd(0),ci(0),tci(0),wt1(0),wt2(0); ap = (h+l+c)/3 ; esa = ema(ap, n1); dd = ema(abs(ap - esa), n1); ci = (ap - esa) / (0.015 * dd); tci = ema(ci, n2); wt1 = tci; wt2 = ma(wt1,4); plot1(0,"0",GRAY); plot2(obLevel1,"obLevel1",red); plot3(osLevel1,"osLevel1",green); plot4(obLevel2,"obLevel2",red); plot5(osLevel2,"osLevel2",green); plot6(wt1,"wt1",green); plot7(wt2,"wt2",red); plot8(wt1-wt2,"wt1-wt2",blue); 1, 0선 아래에서 골드나는 매수 2, -50 -60선 아래서 골드발생만 매수 3, wt1 이 wt2 를 골드 하는 매수 매도 시스템응 부탁 드립니다 ### 언제나 항상 많은 도움 감사드립니다 ### ### 부족한 설명이 있거나 부족한것이 있다면 검토해서 잘 부탁드립니다###
프로필 이미지
매치다는
2022-12-11
1373
글번호 164495
시스템
답변완료

수식 검증 수정부탁드립니다.

트레이딩뷰 지표를 예스지표로 변환하려는데, 어디서 오류가 있는것인지 출력이 되지 않습니다. 점검 수정 부탁드립니다. ////////////////트레이딩뷰 원 지표식 ////////// study(title="UT Bot Alerts", overlay = true) // Inputs a = input(1, title = "Key Vaule. 'This changes the sensitivity'") c = input(10, title = "ATR Period") h = input(false, title = "Signals from Heikin Ashi Candles") xATR = atr(c) nLoss = a * xATR src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close xATRTrailingStop = 0.0 xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss), iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss), iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss))) pos = 0 pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1, iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue ema = ema(src,1) above = crossover(ema, xATRTrailingStop) below = crossover(xATRTrailingStop, ema) buy = src > xATRTrailingStop and above sell = src < xATRTrailingStop and below barbuy = src > xATRTrailingStop barsell = src < xATRTrailingStop plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny) plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny) barcolor(barbuy ? color.green : na) barcolor(barsell ? color.red : na) alertcondition(buy, "UT Long", "UT Long") alertcondition(sell, "UT Short", "UT Short") ////////// 제가 변환해본 식 //////// Input : a(1), length(10),크기(15); var : truehighv(0),TrueLowv(0),TrueRangev(0),xatr(0),nLoss(0),src(0) ; var : xClose(0),xOpen(0),xHigh(0),xLow(0); var : xATRTrailingStop(0),poss(0), emav(0), ab(0), be(0),tx(0) ; var : dir(0) ; 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[1] > xHigh then TrueHighv = xClose[1]; else TrueHighv = xHigh; If xClose[1] < xLow then TrueLowv = xClose[1]; else TrueLowv = xLow; TrueRangev = TrueHighv - TrueLowv; xatr = ma(TrueRangev,length); nLoss = a * xatr ; ########## src = xClose ; xATRTrailingStop = 0.0 ; xATRTrailingStop = iff(src > xATRTrailingStop[1] and src[1] > xATRTrailingStop[1], max(xATRTrailingStop[1], src - nLoss), iff(src < xATRTrailingStop[1] and src[1] < xATRTrailingStop[1], min(xATRTrailingStop[1],src + nLoss), iff(src > xATRTrailingStop[1], src - nLoss, src + nLoss))); poss = 0 ; poss = iff(src[1] < xATRTrailingStop[1] and src > xATRTrailingStop[1], 1, iff(src[1] > xATRTrailingStop[1] and src < xATRTrailingStop[1], -1, poss[1])) ; emav = ema(src,1); if crossup(emav, xATRTrailingStop) Then ab == true ; if crossup(xATRTrailingStop, emav) Then be == true ; //////////// dir = iff(src > xATRTrailingStop and ab == true , 1 ,iff( src < xATRTrailingStop and be == true , -1 , dir)); if dir == 1 and dir[1] == -1 Then { tx = Text_New(sDate,sTime,low,"▲"); Text_SetStyle(tx,2,0); Text_SetSize(tx, 크기); Text_SetColor(tx,black); } if dir == -1 and dir[1] == 1 Then { tx = Text_New(sDate,sTime,high,"▼"); Text_SetStyle(tx,2,1); Text_SetSize(tx, 크기); Text_SetColor(tx,black); } //////////////
프로필 이미지
당일선물
2022-12-11
1724
글번호 164494
지표
답변완료

부탁 드립니다

도움에 감사 드립니다. 타주기(1.분봉용 2.일봉용)용 수식 부탁 드립니다. 미리 감사 드립니다. input : p(20); input : sig(9); Var : BPower(0), SPower(0),netPower(0); BPower = (((C-C[1])*3 + H-C[1])*100)/C[1]; SPower = (((C[1]-C)*3 + C[1]-L)*100)/C[1]; NetPower = ma(BPower-SPower,p); var1=ma(NetPower,sig); 작성에 참고할 만한 수식) var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0),sum(0); Array : CC[500](0),HH[500](0),LL[500](0),cts[500](0),VV[500](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; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { hh[0] = H; LL[0] = l; VV[0] = 0; for cnt = 1 to 499 { CC[cnt] = CC[cnt-1][1]; HH[cnt] = HH[cnt-1][1]; LL[cnt] = LL[cnt-1][1]; VV[cnt] = VV[cnt-1][1]; CTS[cnt] = CTS[cnt-1][1]; } } CC[0] = C; VV[0] = VV[0] + v; if HH[0] > 0 and H > HH[0] Then HH[0] = H; if LL[0] > 0 and L < LL[0] Then LL[0] = L;
프로필 이미지
yes
2022-12-10
1055
글번호 164493
지표
답변완료

참조 데이터 변수선언

일봉챠트를 참조 데이타로 아래와 같이 작성하고 변수를 확인하면 아무런 변화없이 항상 '0' 입니다. 1 아니면 -1 이여야 하는데, 무엇이 잘못됐나요??? var : START(""); var : PBC(0); // 상승하락확인 // 일봉으로 확인 Var1 = (data6(O[2]) - data6(C[0])); If var1 > 0 then { PBC = -1; } If var1 < 0 then { PBC = 1; } If START = "시작" then { MessageLog("PBC=%0.0f", PBC); } START = "시작";
프로필 이미지
와글이
2022-12-10
1054
글번호 164492
지표

신들의전쟁 님에 의해서 삭제되었습니다.

프로필 이미지
신들의전쟁
2022-12-10
14
글번호 164491
시스템
답변완료

화면분할 좌우측 차트의 인식문제

화면분할시 좌측 우측 차트에서 발생되는 시그널을 인식할 수 있는 함수가 있는지요?
프로필 이미지
사하라
2022-12-10
886
글번호 164490
시스템
답변완료

문의

답변 수식에 input을 사용하여 시뮬레이션 해보았습니다. 6개 변수에 모두 -10 에서 10 까지 1 단위 사용함 up1 up2 값 변화 없음 dn1 dn2 값 변화 없음 zup 값 변화 없음 zdn 위 3개 변수에서 시뮬레이션이 작동하지 않는데 살펴주셨으면 합니다. ********************************************************************************** input : up1(1),up2(2),dn1(-1),dn2(-2),zup(3),zdn(-3); var : uptail(0),body(0),dntail(0),T(0); uptail = H-max(c,o); body = abs(C-O); dntail = min(C-O)-L; T = 0; if C > O Then { if body > uptail+dntail and body > 0 Then T = up1; if body < uptail+dntail and uptail+dntail > 0 Then T = up2; } Else if C < O Then { if body > uptail+dntail and body > 0 Then T = dn1; if body < uptail+dntail and uptail+dntail > 0 Then T = dn2; } Else { if dntail > uptail and dntail > 0 Then T = zup; if dntail < uptail and uptail > 0 Then T = zdn; } if AccumN(T,12) > 5 Then Buy(); if AccumN(T,12) < -5 Then SelL();
프로필 이미지
목마와숙녀
2022-12-10
955
글번호 164489
시스템