커뮤니티

문의

프로필 이미지
레전드
2025-10-28 03:57:40
85
글번호 227387
답변완료

/@version=5 indicator("Higher Time Frame Support/Resistance [BigBeluga]", "HTF Support/Resistance [BigBeluga]",              overlay            = true,              max_bars_back      = 5000,              max_labels_count   = 500)


// Groups string group1 = "Levels 1" string group2 = "Levels 2" string group3 = "Levels 3" string group4 = "Levels 4"


// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{

bool   on_1        = input.bool(true, "", inline = group1) int    len1        = input.int(4, group1, inline = group1), string timeframe1  = input.timeframe("240", "", inline = group1), string style1      = input.string("Solid", "", ["Solid", "Dashed", "Dotted"], inline = group1) color  color1      = input.color(color.green, "", inline = group1)

bool   on_2        = input.bool(true, "", inline = group2) int    len2        = input.int(5, group2, inline = group2), string timeframe2  = input.timeframe("720", "", inline = group2), string style2      = input.string("Solid", "", ["Solid", "Dashed", "Dotted"], inline = group2) color  color2      = input.color(color.blue, "", inline = group2)

bool   on_3        = input.bool(true, "", inline = group3) int    len3        = input.int(5, group3, inline = group3), string timeframe3  = input.timeframe("D", "", inline = group3), string style3      = input.string("Solid", "", ["Solid", "Dashed", "Dotted"], inline = group3) color  color3      = input.color(color.purple, "", inline = group3)

bool   on_4        = input.bool(true, "", inline = group4) int    len4        = input.int(5, group4, inline = group4), string timeframe4  = input.timeframe("W", "", inline = group4), string style4      = input.string("Solid", "", ["Solid", "Dashed", "Dotted"], inline = group4) color  color4      = input.color(color.orange, "", inline = group4)

// Shadow of levels inputs int   s_lWidth    = input.int(5, "Levels Width", group = "Shadow", inline = "Shadow") int   s_tnsp      = input.int(85, "Transperent", group = "Shadow", inline = "Shadow")

int    offset      = input.int(15, "Offset", group = "Labels") string t_size      = input.string("Small", "Size", ["Tiny", "Small", "Normal"], group = "Labels")

// }


// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ // Non Repainting data request function non_rep_request(tf, expresion1)=>     indexHighTF = barstate.isrealtime ? 1 : 0     indexCurrTF = barstate.isrealtime ? 0 : 1     nonRepainting = request.security(syminfo.tickerid, tf, expresion1[indexHighTF])[indexCurrTF]     nonRepainting

// Pivot levels function pivot_levels(timeframe, len, color, stl)=>         style = switch stl         "Solid" => line.style_solid         "Dotted" => line.style_dotted         "Dashed" => line.style_dashed

    text_s = switch t_size         "Small"  => size.small         "Tiny"   => size.tiny         "Normal" => size.normal


    var line pivot_h = line(na)     var line pivot_l = line(na)

    var line pivot_hs = line(na)     var line pivot_ls = line(na)

    var float p_h = float(na)     var float p_l = float(na)

    bool ph = ta.pivothigh(len, len)     bool pl = ta.pivotlow(len, len)

    float p_H = non_rep_request(timeframe, (not na(ph) ? high[len] : na))     float p_L = non_rep_request(timeframe, (not na(pl) ? low[len] : na))

    if not na(p_H)         p_h := float(na)         p_h := p_H         pivot_h := line.new(bar_index[len], p_H, last_bar_index, p_H, color = color)

        pivot_h.set_extend(extend.both)         pivot_h.set_style(style)         line.delete(pivot_h[1])

        // Shadow Line         pivot_hs := line.new(bar_index[len], p_H, last_bar_index, p_H, color = color.new(color, s_tnsp), width = s_lWidth)         pivot_hs.set_extend(extend.both)                 line.delete(pivot_hs[1])        

    if not na(p_L)         p_l := float(na)         p_l := p_L         pivot_l := line.new(bar_index[len], p_L, last_bar_index, p_L, color = color)         pivot_l.set_extend(extend.both)         pivot_l.set_style(style)         line.delete(pivot_l[1])

        // Shadow Line         pivot_ls := line.new(bar_index[len], p_L, last_bar_index, p_L, color = color.new(color, s_tnsp), width = s_lWidth)         pivot_ls.set_extend(extend.both)                 line.delete(pivot_ls[1])        

    if barstate.islast         count1 = 0         count2 = 0

        for i = 1 to 4000             if high[i]*1.0009 >= p_h and high[i] *0.9999 <= p_h and count1 == 0                 count1 := 1                 label.delete(label.new(bar_index[i], p_h, "", color = color, style = label.style_label_down, size = size.tiny)[1])

            if  low[i]*1.0009 >= p_l and low[i]*0.999 <= p_l and count2 == 0                 count2 := 1                 label.delete(label.new(bar_index[i], p_l, "", color = color, style = label.style_label_up, size = size.tiny)[1])

        label.delete(label.new(bar_index+offset, p_h, timeframe + " Pivot High " + str.tostring(p_h, "(#.#)"), color = chart.bg_color, style = label.style_label_left, textcolor = chart.fg_color, size = text_s)[1])         label.delete(label.new(bar_index+offset, p_l, timeframe + " Pivot Low " + str.tostring(p_l, "(#.#)"),  color = chart.bg_color, style = label.style_label_left, textcolor = chart.fg_color, size = text_s)[1])

if on_1     pivot_levels(timeframe1,len1,color1, style1) if on_2     pivot_levels(timeframe2,len2,color2, style2) if on_3     pivot_levels(timeframe3,len3,color3, style3) if on_4     pivot_levels(timeframe4,len4,color4, style4) // }
레벨에서 15분 30분 1시간 4시간으로 변환하여 나타나도록 부탁드립니다.

타분봉swinhigh타분봉swinglow
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-10-28 14:05:37

안녕하세요. 예스스탁입니다. 일주기 이상은 식상 내용이 달라 시간이 많이 소모됩니다. 타주기 분봉만 지정되게 작성해 드립니다. input : on_1(true); input : len1(4); input : timeframe1(15); input : style1(1); //1:"Solid", 2:"Dashed", 3:"Dotted"; input : color1(green); input : on_2(true); input : len2(5); input : timeframe2(30); input : style2(1); //1:"Solid", 2:"Dashed", 3:"Dotted"; input : color2(Blue); input : on_3(true); input : len3(5); input : timeframe3(60); input : style3(1); //1:"Solid", 2:"Dashed", 3:"Dotted"; input : color3(purple); input : on_4(true); input : len4(5); input : timeframe4(240); input : style4(1); input : color4(orange); var : s1(0),d1(0),tm(0),tf1(0),tf2(0),tf3(0),tf4(0),i(0); Array : H1[100](0),hd1[100](0),ht1[100](0),L1[100](0),LD1[100](0),LT1[100](0); Array : H2[100](0),hd2[100](0),ht2[100](0),L2[100](0),LD2[100](0),LT2[100](0); Array : H3[100](0),hd3[100](0),ht3[100](0),L3[100](0),LD3[100](0),LT3[100](0); Array : H4[100](0),hd4[100](0),ht4[100](0),L4[100](0),LD4[100](0),LT4[100](0); var : RH1(0),HH1(0),RL1(0),LL1(0); var : RH2(0),HH2(0),RL2(0),LL2(0); var : RH3(0),HH3(0),RL3(0),LL3(0); var : RH4(0),HH4(0),RL4(0),LL4(0); var : htl1(0),ltl1(0),htx1(0),ltx1(0); var : htl2(0),ltl2(0),htx2(0),ltx2(0); var : htl3(0),ltl3(0),htx3(0),ltx3(0); var : htl4(0),ltl4(0),htx4(0),ltx4(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%timeframe1; TF2 = TM%timeframe2; TF3 = TM%timeframe3; TF4 = TM%timeframe4; if Bdate != Bdate[1] or (Bdate == Bdate[1] and timeframe1 > 1 and TF1 < TF1[1]) or (Bdate == Bdate[1] and timeframe1 > 1 and TM >= TM[1]+timeframe1) or (Bdate == Bdate[1] and timeframe1 == 1 and TM > TM[1]) Then { For i = 99 DownTo 1 { h1[i] = h1[i-1]; hd1[i] = hd1[i-1]; ht1[i] = ht1[i-1]; l1[i] = l1[i-1]; ld1[i] = ld1[i-1]; lt1[i] = lt1[i-1]; } h1[0] = h; hd1[0] = sDate; ht1[0] = sTime; l1[0] = l; ld1[0] = sDate; lt1[0] = sTime; if h1[len1*2+1] > 0 and l1[len1*2+1] > 0 Then { RH1 = 0; HH1 = 0; RL1 = 0; LL1 = 0; For i = 1 to len1*2+1 { if i <= len1 and(RH1 == 0 or (RH1 > 0 and h1[i] > RH1)) Then { RH1 = h1[i]; } if HH1 == 0 or (HH1 > 0 and h1[i] > HH1) Then { HH1 = h1[i]; } if i <= len1 and (RL1 == 0 or (RL1 > 0 and l1[i] < RL1)) Then { RL1 = l1[i]; } if LL1 == 0 or (LL1 > 0 and l1[i] < LL1) Then { LL1 = l1[i]; } } if RH1 < HH1 and h1[len1+1] == HH1 Then { TL_Delete(htl1); htl1 = TL_New(hd1[len1+1],ht1[len1+1],h1[len1+1],sDate,sTime,h1[len1+1]); TL_SetColor(htl1,color1); TL_SetStyle(htl1,style1); TL_SetExtLeft(htl1,true); TL_SetExtRight(htl1,true); Text_Delete(htx1); htx1 = Text_New(hd1[len1+1],ht1[len1+1],h1[len1+1],"▼"); Text_SetStyle(htx1,2,1); Text_SetColor(htx1,color1); } if RL1 > LL1 and l1[len1+1] == LL1 Then { TL_Delete(ltl1); ltl1 = TL_New(ld1[len1+1],lt1[len1+1],l1[len1+1],sDate,sTime,l1[len1+1]); TL_SetColor(ltl1,color1); TL_SetStyle(ltl1,style1); TL_SetExtLeft(ltl1,true); TL_SetExtRight(ltl1,true); Text_Delete(ltx1); ltx1 = Text_New(ld1[len1+1],lt1[len1+1],l1[len1+1],"▲"); Text_SetStyle(ltx1,2,0); Text_SetColor(ltx1,color1); } } } if h1[0] > 0 and h >= h1[0] Then { h1[0] = h; hd1[0] = sDate; ht1[0] = sTime; } if l1[0] > 0 and l <= l1[0] Then { l1[0] = l; ld1[0] = sDate; lt1[0] = sTime; } if Bdate != Bdate[1] or (Bdate == Bdate[1] and timeframe2 > 1 and TF2 < TF2[1]) or (Bdate == Bdate[1] and timeframe2 > 1 and TM >= TM[1]+timeframe2) or (Bdate == Bdate[1] and timeframe2 == 1 and TM > TM[1]) Then { For i = 99 DownTo 1 { h2[i] = h2[i-1]; hd2[i] = hd2[i-1]; ht2[i] = ht2[i-1]; l2[i] = l2[i-1]; ld2[i] = ld2[i-1]; lt2[i] = lt2[i-1]; } h2[0] = h; hd2[0] = sDate; ht2[0] = sTime; l2[0] = l; ld2[0] = sDate; lt2[0] = sTime; if h2[len2*2+1] > 0 and l2[len2*2+1] > 0 Then { RH2 = 0; HH2 = 0; RL2 = 0; LL2 = 0; For i = 1 to len2*2+1 { if i <= len2 and(RH2 == 0 or (RH2 > 0 and h2[i] > RH2)) Then { RH2 = h2[i]; } if HH2 == 0 or (HH2 > 0 and h2[i] > HH2) Then { HH2 = h2[i]; } if i <= len2 and (RL2 == 0 or (RL2 > 0 and l2[i] < RL2)) Then { RL2 = l2[i]; } if LL2 == 0 or (LL2 > 0 and l2[i] < LL2) Then { LL2 = l2[i]; } } if RH2 < HH2 and h2[len2+1] == HH2 Then { TL_Delete(htl2); htl2 = TL_New(hd2[len2+1],ht2[len2+1],h2[len2+1],sDate,sTime,h2[len2+1]); TL_SetColor(htl2,color2); TL_SetStyle(htl2,style2); TL_SetExtLeft(htl2,true); TL_SetExtRight(htl2,true); Text_Delete(htx2); htx2 = Text_New(hd2[len2+1],ht2[len2+1],h2[len2+1],"▼"); Text_SetStyle(htx2,2,1); Text_SetColor(htx2,color2); } if RL2 > LL2 and l2[len2+1] == LL2 Then { TL_Delete(ltl2); ltl2 = TL_New(ld2[len2+1],lt2[len2+1],l2[len2+1],sDate,sTime,l2[len2+1]); TL_SetColor(ltl2,color2); TL_SetStyle(ltl2,style2); TL_SetExtLeft(ltl2,true); TL_SetExtRight(ltl2,true); Text_Delete(ltx2); ltx2 = Text_New(ld2[len2+1],lt2[len2+1],l2[len2+1],"▲"); Text_SetStyle(ltx2,2,0); Text_SetColor(ltx2,color2); } } } if h2[0] > 0 and h >= h2[0] Then { h2[0] = h; hd2[0] = sDate; ht2[0] = sTime; } if l2[0] > 0 and l <= l2[0] Then { l2[0] = l; ld2[0] = sDate; lt2[0] = sTime; } if Bdate != Bdate[1] or (Bdate == Bdate[1] and timeframe3 > 1 and TF3 < TF3[1]) or (Bdate == Bdate[1] and timeframe3 > 1 and TM >= TM[1]+timeframe3) or (Bdate == Bdate[1] and timeframe3 == 1 and TM > TM[1]) Then { For i = 99 DownTo 1 { h3[i] = h3[i-1]; hd3[i] = hd3[i-1]; ht3[i] = ht3[i-1]; l3[i] = l3[i-1]; ld3[i] = ld3[i-1]; lt3[i] = lt3[i-1]; } h3[0] = h; hd3[0] = sDate; ht3[0] = sTime; l3[0] = l; ld3[0] = sDate; lt3[0] = sTime; if h3[len3*2+1] > 0 and l3[len3*2+1] > 0 Then { RH3 = 0; HH3 = 0; RL3 = 0; LL3 = 0; For i = 1 to len3*2+1 { if i <= len3 and(RH3 == 0 or (RH3 > 0 and h3[i] > RH3)) Then { RH3 = h3[i]; } if HH3 == 0 or (HH3 > 0 and h3[i] > HH3) Then { HH3 = h3[i]; } if i <= len3 and (RL3 == 0 or (RL3 > 0 and l3[i] < RL3)) Then { RL3 = l3[i]; } if LL3 == 0 or (LL3 > 0 and l3[i] < LL3) Then { LL3 = l3[i]; } } if RH3 < HH3 and h3[len3+1] == HH3 Then { TL_Delete(htl3); htl3 = TL_New(hd3[len3+1],ht3[len3+1],h3[len3+1],sDate,sTime,h3[len3+1]); TL_SetColor(htl3,color3); TL_SetStyle(htl3,style3); TL_SetExtLeft(htl3,true); TL_SetExtRight(htl3,true); Text_Delete(htx3); htx3 = Text_New(hd3[len3+1],ht3[len3+1],h3[len3+1],"▼"); Text_SetStyle(htx3,2,1); Text_SetColor(htx3,color3); } if RL3 > LL3 and l3[len3+1] == LL3 Then { TL_Delete(ltl3); ltl3 = TL_New(ld3[len3+1],lt3[len3+1],l3[len3+1],sDate,sTime,l3[len3+1]); TL_SetColor(ltl3,color3); TL_SetStyle(ltl3,style3); TL_SetExtLeft(ltl3,true); TL_SetExtRight(ltl3,true); Text_Delete(ltx3); ltx3 = Text_New(ld3[len3+1],lt3[len3+1],l3[len3+1],"▲"); Text_SetStyle(ltx3,2,0); Text_SetColor(ltx3,color3); } } } if h3[0] > 0 and h >= h3[0] Then { h3[0] = h; hd3[0] = sDate; ht3[0] = sTime; } if l3[0] > 0 and l <= l3[0] Then { l3[0] = l; ld3[0] = sDate; lt3[0] = sTime; } if Bdate != Bdate[1] or (Bdate == Bdate[1] and timeframe4 > 1 and TF4 < TF4[1]) or (Bdate == Bdate[1] and timeframe4 > 1 and TM >= TM[1]+timeframe4) or (Bdate == Bdate[1] and timeframe4 == 1 and TM > TM[1]) Then { For i = 99 DownTo 1 { h4[i] = h4[i-1]; hd4[i] = hd4[i-1]; ht4[i] = ht4[i-1]; l4[i] = l4[i-1]; ld4[i] = ld4[i-1]; lt4[i] = lt4[i-1]; } h4[0] = h; hd4[0] = sDate; ht4[0] = sTime; l4[0] = l; ld4[0] = sDate; lt4[0] = sTime; if h4[len4*2+1] > 0 and l4[len4*2+1] > 0 Then { RH4 = 0; HH4 = 0; RL4 = 0; LL4 = 0; For i = 1 to len4*2+1 { if i <= len4 and(RH4 == 0 or (RH4 > 0 and h4[i] > RH4)) Then { RH4 = h4[i]; } if HH4 == 0 or (HH4 > 0 and h4[i] > HH4) Then { HH4 = h4[i]; } if i <= len4 and (RL4 == 0 or (RL4 > 0 and l4[i] < RL4)) Then { RL4 = l4[i]; } if LL4 == 0 or (LL4 > 0 and l4[i] < LL4) Then { LL4 = l4[i]; } } if RH4 < HH4 and h4[len4+1] == HH4 Then { TL_Delete(htl4); htl4 = TL_New(hd4[len4+1],ht4[len4+1],h4[len4+1],sDate,sTime,h4[len4+1]); TL_SetColor(htl4,color4); TL_SetStyle(htl4,style4); TL_SetExtLeft(htl4,true); TL_SetExtRight(htl4,true); Text_Delete(htx4); htx4 = Text_New(hd4[len4+1],ht4[len4+1],h4[len4+1],"▼"); Text_SetStyle(htx4,2,1); Text_SetColor(htx4,color4); } if RL4 > LL4 and l4[len4+1] == LL4 Then { TL_Delete(ltl4); ltl4 = TL_New(ld4[len4+1],lt4[len4+1],l4[len4+1],sDate,sTime,l4[len4+1]); TL_SetColor(ltl4,color4); TL_SetStyle(ltl4,style4); TL_SetExtLeft(ltl4,true); TL_SetExtRight(ltl4,true); Text_Delete(ltx4); ltx4 = Text_New(ld4[len4+1],lt4[len4+1],l4[len4+1],"▲"); Text_SetStyle(ltx4,2,0); Text_SetColor(ltx4,color4); } } } if h4[0] > 0 and h >= h4[0] Then { h4[0] = h; hd4[0] = sDate; ht4[0] = sTime; } if l4[0] > 0 and l <= l4[0] Then { l4[0] = l; ld4[0] = sDate; lt4[0] = sTime; } } 즐거운 하루되세요