커뮤니티

수식도움 부탁드립니다.

프로필 이미지
당일선물
2022-12-08 04:52:25
768
글번호 164422
답변완료
아래수식에서 타주기 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); }
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-12-08 15:59:30

안녕하세요 예스스탁입니다. 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 : 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),longStop1(0),shortStop1(0),hv(0),lv(0); var : sum2(0),longStop21(0),shortStop21(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; Xopen21 = xopen2[1]; Xhigh21 = xhigh2[1]; Xlow21 = xlow2[1]; Xclose21 = xclose2[1]; longStop21 = longStop2[1]; ShortStop21 = 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 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) ; } hsc2[0] = xclose2 ; if ii2 > 1 Then { If xClose21 > xHigh2 then TrueHighv2 = xClose21; else TrueHighv2 = xHigh2; If xClose21 < xLow2 then TrueLowv2 = xClose21; 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 = longStop21; longStop2 = iff(hsc2[1] > longStopPrev2 , max(longStop2, longStopPrev2) , longStop2); shortStop2 = lv2 + atrv2; shortStopPrev2 = shortStop21; 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); } 즐거운 하루되세요 > 당일선물 님이 쓴 글입니다. > 제목 : 수식도움 부탁드립니다. > 아래수식에서 타주기 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); }