커뮤니티

지표수식 변환 요청드립니다

프로필 이미지
당일선물
2023-05-04 13:56:33
2011
글번호 168718
답변완료

첨부 이미지

수고하십니다. 아래지표식에서 타주기분지표가 종가완성봉기준으로 출력되도록 부탁드립니다. 그림참조 그림위=현 아래수식이용 예스챠트 출력화면(지표가 출렁거림), 그림아래=트레이딩뷰 동일지표 출력화면 //============== input : 분(5),useClose1(true),length(1),mult(1); var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0); var : dir(1),dir1(0) ; var : truehighv(0),TrueLowv(0),hsatr(0) ; var : xClose(0),xOpen(0),xHigh(0),xLow(0); var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0); var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0); var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0); var : longcolor(Crimson),shortcolor(Blue),tx(0); Array : TrueRangev[100](0),AccumValue[100](0); Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[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; /// TF = TM%분; ///30분 if Bdate != Bdate[1] or (Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or (Bdate == Bdate[1] and 분 == 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]; } 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 useClose1 == 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 dir == 1 Then { plot1(longStop,"Long Stop",longColor); NoPlot(2); } Else { NoPlot(1); plot2(shortStop,"Short Stop",shortColor); } //======================
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-05-04 14:55:25

안녕하세요 예스스탁입니다. 봉완성시값으로 그려지게 수정해 드립니다. 다만 봉완성시기준으로 과거 5분에 소급해서 그릴수는 없습니다. 값자체가 지정한 타주기봉 완성기준으로 값을 저장해 다음 타주기봉 완성시까지 그려지게 됩니다. input : 분(5),useClose1(true),length(1),mult(1); var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0); var : dir(1),dir1(0) ; var : truehighv(0),TrueLowv(0),hsatr(0) ; var : xClose(0),xOpen(0),xHigh(0),xLow(0); var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0); var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0); var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0); var : longcolor(Crimson),shortcolor(Blue),tx(0); Array : TrueRangev[100](0),AccumValue[100](0); Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[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; TF = TM%분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or (Bdate == Bdate[1] and 분 == 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]; } 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 useClose1 == 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)); } } var : tm1(0),tf1(0),t(0),s(0); if D1 > 0 then { if NextBarSdate == D1 Then TM1 = TimeToMinutes(NextBarStime)-S1; Else TM1 = TimeToMinutes(NextBarStime)+1440-S1; TF1 = TM1%분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and 분 > 1 and TF1 < TF1[1]) or (Bdate == Bdate[1] and 분 > 1 and TM1 >= TM1[1]+분) or (Bdate == Bdate[1] and 분 == 1 and TM1 > TM1[1]) Then { t = dir; if t == 1 Then s = longstop; Else s = shortstop; } } IF t == 1 Then { plot1(s,"Long Stop",longColor); NoPlot(2); } Else { NoPlot(1); plot2(s,"Short Stop",shortColor); } 즐거운 하루되세요 > 당일선물 님이 쓴 글입니다. > 제목 : 지표수식 변환 요청드립니다 > 수고하십니다. 아래지표식에서 타주기분지표가 종가완성봉기준으로 출력되도록 부탁드립니다. 그림참조 그림위=현 아래수식이용 예스챠트 출력화면(지표가 출렁거림), 그림아래=트레이딩뷰 동일지표 출력화면 //============== input : 분(5),useClose1(true),length(1),mult(1); var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0); var : dir(1),dir1(0) ; var : truehighv(0),TrueLowv(0),hsatr(0) ; var : xClose(0),xOpen(0),xHigh(0),xLow(0); var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0); var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0); var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0); var : longcolor(Crimson),shortcolor(Blue),tx(0); Array : TrueRangev[100](0),AccumValue[100](0); Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[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; /// TF = TM%분; ///30분 if Bdate != Bdate[1] or (Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or (Bdate == Bdate[1] and 분 == 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]; } 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 useClose1 == 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 dir == 1 Then { plot1(longStop,"Long Stop",longColor); NoPlot(2); } Else { NoPlot(1); plot2(shortStop,"Short Stop",shortColor); } //======================