답변완료
부탁합니다.
트뷰 지표인데 예스로 부탁합니다.indicator( overlay = true, max_lines_count = 500, max_bars_back = 500)src = input(hlc3, title = 'source')len = input.int(88, title = 'lenght', maxval = 500)cr(x, y) => z = 0.0 weight = 0.0 for i = 0 to y - 1 by 1 z := z + x[i] * ((y - 1) / 2 + 1 - math.abs(i - (y - 1) / 2)) z z / ((y + 1) / 2 * (y + 1) / 2)cr = cr(src, 2 * len - 1)width = 2//plot(cr, color= #cf0202, linewidth=width,offset=-len+1)var dizii = array.new_float(500)for k = 0 to len - 1 by 1 sum = 0.0 for i = 0 to 2 * len - 2 - k by 1 sum := sum + (len - math.abs(len - 1 - k - i)) * src[i] / (len * len - k * (k + 1) / 2) sum array.set(dizii, k, sum)mult = input.float(2.0, minval = 0.001, maxval = 50, title = 'StdDev')dev = mult * ta.stdev(src, len)nmid = ta.wma(src, len)nupper = nmid + ta.wma(dev,len)nlower = nmid - ta.wma(dev,len)//plot(nmid)//plot(nlower)//plot(nupper)upper = cr + cr(dev, 2 * len - 1)lower = cr - cr(dev, 2 * len - 1)cu = input.color(color.rgb(255, 137, 137), 'upper band color')cl = input.color(color.rgb(137, 255, 97), 'lower band color')plot(lower, color = cl, offset = 1 - len, linewidth = 2, display = display.pane)plot(upper, color = cu, offset = 1 - len, linewidth = 2, display = display.pane)dashed = input.bool(false)transp = input.bool(true)d = dashed ? 2 : 1tra = transp ? 1 : 0// extrapolationvar diz = array.new_float(500)var lin = array.new_line()var diz2 = array.new_float(500)var lin2 = array.new_line(0)// Extrapolation - dynamic lines that redraw every barif bar_index > len // Önceki çizgileri sil (varsa) if array.size(lin) > 0 for i = 0 to array.size(lin) - 1 line.delete(array.get(lin, i)) array.clear(lin) if array.size(lin2) > 0 for i = 0 to array.size(lin2) - 1 line.delete(array.get(lin2, i)) array.clear(lin2) // Yeni extrapolation hesapla for k = 0 to len - 1 by 1 sum = 0.0 dv = 0.0 for i = 0 to 2 * len - 2 - k by 1 sum := sum + (len - math.abs(len - 1 - k - i)) * src[i] / (len * len - k * (k + 1) / 2) dv := dv + (len - math.abs(len - 1 - k - i)) * dev[i] / (len * len - k * (k + 1) / 2) array.set(diz, k, sum + dv) array.set(diz2, k, sum - dv) // Yeni çizgileri oluştur for i = 0 to len / d - 2 by 1 l1 = line.new( bar_index + i * d + 1 - len, array.get(diz, i * d), bar_index + i * d + 2 - len, array.get(diz, i * d + 1), width = width, color = color.new(cu, tra * i * 95 / (len / d - 1)) ) array.push(lin, l1) l2 = line.new( bar_index + i * d + 1 - len, array.get(diz2, i * d), bar_index + i * d + 2 - len, array.get(diz2, i * d + 1), width = width, color = color.new(cl, tra * i * 95 / (len / d - 1)) ) array.push(lin2, l2)plot(array.get(diz, len - 1), color = color.new(cu, 100))plot(array.get(diz2, len - 1), color = color.new(cl, 100))//plot(array.get(dizii, len - 1), color = color.new(cl, 10))alertcondition(ta.crossover(close, array.get(diz, len - 1)) or ta.crossunder(close, array.get(diz2, len - 1)), title = 'faytterro bands alert', message = 'warning! this is an early warning alert, not a buy or sell signal. Remember that the indicator repaints to a limited extent on the last bars.')
답변완료
수식 좀 부탁 드림니다.(2건)
ㅇ 좋은 한주 되십시요. ㅇ아래 수식 추세선 좀 안보이게 숨김 요청 드림니다. 즉 상하선은 굵게 하고 추세선은 안보이게 하고 싶습니다. ##아래 수식Input : length(5),종가사용여부(0),굵기(0),텍스트크기(12);Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""), TL(0),Text1(0),TL1(0),TL2(0),TL11(0),TL21(0);Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTimevar : TL3(0),TL4(0),TX3(0),TX4(0);#==========================================#HH = IFF(종가사용여부==1,C,H);LL = IFF(종가사용여부==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{ 최종고가 = 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; TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL1 = TL_New(고[1,3],고[1,4],고[1,1],NextBarSdate,NextBarStime,고[1,1]); // TL11 = TL1[1]; TL_SetSize(TL,굵기); TL_SetColor(TL,Red); TL_SetSize(TL1,굵기); TL_SetColor(TL1,Red); TL_SetSize(TL11,굵기); TL_SetColor(TL11,Red); // Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2)); Text_SetStyle(Text1, 2, 1); Text_SetSize(text1,텍스트크기); // TL3 = TL_New(저[1,3],저[1,4],(고[1,1]+저[1,1])/2,고[1,3],고[1,4],(고[1,1]+저[1,1])/2); TL_SetSize(TL3,5); TL_SetColor(TL3,Red); Condition3 = False; /* if 고[1,1] > 고[2,1] Then { TX3 = Text_New(고[1,3],고[1,4],고[1,1],"상돌파"+NewLine); Text_SetStyle(TX3,2,1); Condition3 = true; }*/ } Else If 고[1,1] < HH Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH; 고[1,2] = Index; 고[1,3] = sDate; 고[1,4] = sTime; TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]); TL_SetEnd(TL11,고[1,3],고[1,4],고[2,1]); TL_SetBegin(TL1,고[1,3],고[1,4],고[1,1]); // 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임 Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]); Text_SetString(Text1,NumToStr(고[1,1],2)); TL_SetBegin(TL3,저[1,3],저[1,4],(고[1,1]+저[1,1])/2); TL_SetEnd(TL3,고[1,3],고[1,4],(고[1,1]+저[1,1])/2); if Condition3 == False Then { if 고[1,1] > 고[2,1] Then { // TX3 = Text_New(고[1,3],고[1,4],고[1,1],"상돌파"+NewLine);// Text_SetStyle(TX3,2,1);// Condition3 = true; } } Else { Text_SetLocation(TX3,고[1,3],고[1,4],고[1,1]); } } 최종꼭지점 = "고점";}#==========================================#If 처리구분 == "저점처리" Then{ 최종저가 = 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; TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL2 = TL_New(저[1,3],저[1,4],저[1,1],NextBarSdate,NextBarStime,저[1,1]); // TL21 = TL2[1]; TL_SetEnd(TL21,저[2,3],저[2,4],저[2,1]); TL_SetSize(TL,굵기); TL_SetColor(TL,Blue); TL_SetSize(TL2,굵기); TL_SetColor(TL2,Blue); TL_SetSize(TL21,굵기); TL_SetColor(TL21,Blue); // Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2)); Text_SetStyle(Text1, 2, 0); Text_SetSize(text1,텍스트크기); // TL4 = TL_New(고[1,3],고[1,4],(고[1,1]+저[1,1])/2,저[1,3],저[1,4],(고[1,1]+저[1,1])/2); TL_SetSize(TL4,5); TL_SetColor(TL4,Blue); Condition4 = False; if 저[1,1] < 저[2,1] Then { // TX4 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+"하돌파");// Text_SetStyle(TX4,2,0);// Condition4 = true; } } Else If 저[1,1] > LL then { 저[1,1] = LL; 저[1,2] = Index; 저[1,3] = sDate; 저[1,4] = sTime; TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]); TL_SetEnd(TL21,저[1,3],저[1,4],저[2,1]); TL_SetBegin(TL2,저[1,3],저[1,4],저[1,1]); Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]); //Text_SetString(Text1,NumToStr(저[1,1],2)); TL_SetBegin(TL4,고[1,3],고[1,4],(고[1,1]+저[1,1])/2); TL_SetEnd(TL4,저[1,3],저[1,4],(고[1,1]+저[1,1])/2); if Condition4 == False Then { if 저[1,1] < 저[2,1] Then { // TX4 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+"하돌파");// Text_SetStyle(TX4,2,0);// Condition4 = true; } } Else { Text_SetLocation(TX4,저[1,3],저[1,4],저[1,1]); } } 최종꼭지점 = "저점";}TL_SetEnd(TL1,NextBarSdate,NextBarStime,고[1,1]);TL_SetEnd(TL2,NextBarSdate,NextBarStime,저[1,1]);고맙습니다.