커뮤니티

수식 변환을 부탁드려요

프로필 이미지
고도산
2025-03-18 18:09:50
405
글번호 189307
답변완료
다음 TradingView 수식을 YesTrader로 부탁드립니다. // &#169; BigBeluga //@version=6 indicator("Peak Reaction Zones [BigBeluga]", overlay = true, max_labels_count = 500, max_bars_back = 500) var high_i = int(na) var high_v = float(na) var low_i = int(na) var low_v = float(na) // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ lookback = input(72) multiplier = input.float(1, "Zones Width", step = 0.1, inline = "h/l") high_col = input.color(color.red, "", inline = "h/l") low_col = input.color(color.lime, "", inline = "h/l") // } // CALCULATIONS――――――――――{ highest = ta.highest(lookback) lowest = ta.lowest(lookback) atr = ta.atr(200) * multiplier if high[1] == highest[1] and high < highest high_i := bar_index-1 high_v := high[1] if low[1] == lowest[1] and low > lowest low_i := bar_index-1 low_v := low[1] draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } // PLOT // CALCULATIONS――――――――――{ if barstate.islast size = bar_index - (high_i > low_i ? low_i : high_i) draw_zone(high_i, high_v, true, high_col) draw_zone(low_i, low_v, false, low_col) mid = math.avg(high_v, low_v) mid_index = bar_index - size/2 line.delete(line.new(mid_index, mid, bar_index, mid, color = chart.fg_color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, mid, str.tostring(mid, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1]) for i = 0 to size index = bar_index-i-2 if low[i+3] > low_v+atr and low[i+2] < low_v+atr and high[i+1] > low_v+atr and index > low_i label.new(index, low[i+2], "", style = label.style_label_up, color = low_col, size = size.tiny) if high[i+3] < high_v-atr and high[i+2] > high_v-atr and low[i+1] < high_v-atr and index > high_i label.new(index, high[i+2], "", style = label.style_label_down, color = high_col, size = size.tiny) // }
지표
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2025-03-19 11:22:47

안녕하세요 예스스탁입니다. input : lookback(72); input : multiplier(1); input : high_col(red); input : low_col(lime); var : hest(0),lest(0); var : alpha(0),source(0),ATRV(0),A(0); var : high_i(Nan),high_D(Nan),high_T(Nan),high_V(Nan); VAR : low_i(Nan),low_D(Nan),low_T(Nan),low_V(Nan); hest = highest(H,lookback); lest = lowest(L,lookback); alpha = 1 / 200 ; source = TrueRange; ATrV = IFf(IsNan(ATrV[1]) == true, ma(source,200) , alpha * source + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1])); A = ATRV*multiplier; if high[1] == hest[1] and high < hest Then { high_i = Index-1; high_d = sDate[1]; high_t = sTime[1]; high_v = high[1]; } if low[1] == lest[1] and low > lest Then { low_i = Index-1; low_v = low[1]; } /* draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } */ var : size(0),mid(0),mid_index(0),i(0),idx(0); var : hTL1(0),hTL2(0),hTX(0); var : lTL1(0),lTL2(0),lTX(0); var : mTL(0),mTX(0); size = index - IFf(high_i > low_i , low_i , high_i); #draw_zone(high_i, high_v, true, high_col) #draw_zone(low_i, low_v, false, low_col) TL_Delete(hTL1); TL_Delete(hTL2); Text_Delete(hTX); hTL1 = TL_New(sDate[Index-high_i],sTime[Index-high_i],high_v,NextBarSdate,NextBarStime,high_v); TL_SetColor(hTL1,high_col); TL_SetSize(hTL1,2); hTL2 = TL_New(sDate[(Index-high_i)-3],sTime[(Index-high_i)-3],high_v-A,NextBarSdate,NextBarStime,high_v-A); TL_SetColor(hTL2,high_col); TL_SetSize(hTL2,0); TL_SetStyle(hTL2,3); hTX = Text_New(NextBarSdate,NextBarStime,high_v,ntostr(high_v,2)); Text_SetColor(hTX,high_col); Text_SetStyle(hTX,0,2); TL_Delete(lTL1); TL_Delete(lTL2); Text_Delete(lTX); lTL1 = TL_New(sDate[Index-Low_i],sTime[Index-Low_i],Low_v,NextBarSdate,NextBarStime,Low_v); TL_SetColor(lTL1,Low_col); TL_SetSize(lTL1,2); lTL2 = TL_New(sDate[(Index-low_i)-3],sTime[(Index-low_i)-3],low_v+A,NextBarSdate,NextBarStime,low_v+A); TL_SetColor(lTL2,Low_col); TL_SetSize(lTL2,0); TL_SetStyle(lTL2,3); lTX = Text_New(NextBarSdate,NextBarStime,low_v,ntostr(low_v,2)); Text_SetColor(lTX,low_col); Text_SetStyle(lTX,0,2); mid = avg(high_v, low_v); mid_index = size/2; TL_Delete(mTL); Text_Delete(mTX); mTL = TL_New(sDate[mid_index],sTime[mid_index],mid,NextBarSdate,NextBarStime,mid); TL_SetColor(mTL,Black); TL_SetSize(mTL,0); TL_SetStyle(mTL,3); mTX = Text_New(NextBarSdate,NextBarStime,mid,ntostr(mid,2)); Text_SetColor(mTX,Black); Text_SetStyle(mTX,0,2); 즐거운 하루되세요 > 고도산 님이 쓴 글입니다. > 제목 : 수식 변환을 부탁드려요 > 다음 TradingView 수식을 YesTrader로 부탁드립니다. // &#169; BigBeluga //@version=6 indicator("Peak Reaction Zones [BigBeluga]", overlay = true, max_labels_count = 500, max_bars_back = 500) var high_i = int(na) var high_v = float(na) var low_i = int(na) var low_v = float(na) // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ lookback = input(72) multiplier = input.float(1, "Zones Width", step = 0.1, inline = "h/l") high_col = input.color(color.red, "", inline = "h/l") low_col = input.color(color.lime, "", inline = "h/l") // } // CALCULATIONS――――――――――{ highest = ta.highest(lookback) lowest = ta.lowest(lookback) atr = ta.atr(200) * multiplier if high[1] == highest[1] and high < highest high_i := bar_index-1 high_v := high[1] if low[1] == lowest[1] and low > lowest low_i := bar_index-1 low_v := low[1] draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } // PLOT // CALCULATIONS――――――――――{ if barstate.islast size = bar_index - (high_i > low_i ? low_i : high_i) draw_zone(high_i, high_v, true, high_col) draw_zone(low_i, low_v, false, low_col) mid = math.avg(high_v, low_v) mid_index = bar_index - size/2 line.delete(line.new(mid_index, mid, bar_index, mid, color = chart.fg_color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, mid, str.tostring(mid, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1]) for i = 0 to size index = bar_index-i-2 if low[i+3] > low_v+atr and low[i+2] < low_v+atr and high[i+1] > low_v+atr and index > low_i label.new(index, low[i+2], "", style = label.style_label_up, color = low_col, size = size.tiny) if high[i+3] < high_v-atr and high[i+2] > high_v-atr and low[i+1] < high_v-atr and index > high_i label.new(index, high[i+2], "", style = label.style_label_down, color = high_col, size = size.tiny) // }
프로필 이미지

고도산

2025-03-19 12:59:43

아무 것도 안보니는데요? 제가 무얼 세팅해야 하나요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환을 부탁드려요 > 안녕하세요 예스스탁입니다. input : lookback(72); input : multiplier(1); input : high_col(red); input : low_col(lime); var : hest(0),lest(0); var : alpha(0),source(0),ATRV(0),A(0); var : high_i(Nan),high_D(Nan),high_T(Nan),high_V(Nan); VAR : low_i(Nan),low_D(Nan),low_T(Nan),low_V(Nan); hest = highest(H,lookback); lest = lowest(L,lookback); alpha = 1 / 200 ; source = TrueRange; ATrV = IFf(IsNan(ATrV[1]) == true, ma(source,200) , alpha * source + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1])); A = ATRV*multiplier; if high[1] == hest[1] and high < hest Then { high_i = Index-1; high_d = sDate[1]; high_t = sTime[1]; high_v = high[1]; } if low[1] == lest[1] and low > lest Then { low_i = Index-1; low_v = low[1]; } /* draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } */ var : size(0),mid(0),mid_index(0),i(0),idx(0); var : hTL1(0),hTL2(0),hTX(0); var : lTL1(0),lTL2(0),lTX(0); var : mTL(0),mTX(0); size = index - IFf(high_i > low_i , low_i , high_i); #draw_zone(high_i, high_v, true, high_col) #draw_zone(low_i, low_v, false, low_col) TL_Delete(hTL1); TL_Delete(hTL2); Text_Delete(hTX); hTL1 = TL_New(sDate[Index-high_i],sTime[Index-high_i],high_v,NextBarSdate,NextBarStime,high_v); TL_SetColor(hTL1,high_col); TL_SetSize(hTL1,2); hTL2 = TL_New(sDate[(Index-high_i)-3],sTime[(Index-high_i)-3],high_v-A,NextBarSdate,NextBarStime,high_v-A); TL_SetColor(hTL2,high_col); TL_SetSize(hTL2,0); TL_SetStyle(hTL2,3); hTX = Text_New(NextBarSdate,NextBarStime,high_v,ntostr(high_v,2)); Text_SetColor(hTX,high_col); Text_SetStyle(hTX,0,2); TL_Delete(lTL1); TL_Delete(lTL2); Text_Delete(lTX); lTL1 = TL_New(sDate[Index-Low_i],sTime[Index-Low_i],Low_v,NextBarSdate,NextBarStime,Low_v); TL_SetColor(lTL1,Low_col); TL_SetSize(lTL1,2); lTL2 = TL_New(sDate[(Index-low_i)-3],sTime[(Index-low_i)-3],low_v+A,NextBarSdate,NextBarStime,low_v+A); TL_SetColor(lTL2,Low_col); TL_SetSize(lTL2,0); TL_SetStyle(lTL2,3); lTX = Text_New(NextBarSdate,NextBarStime,low_v,ntostr(low_v,2)); Text_SetColor(lTX,low_col); Text_SetStyle(lTX,0,2); mid = avg(high_v, low_v); mid_index = size/2; TL_Delete(mTL); Text_Delete(mTX); mTL = TL_New(sDate[mid_index],sTime[mid_index],mid,NextBarSdate,NextBarStime,mid); TL_SetColor(mTL,Black); TL_SetSize(mTL,0); TL_SetStyle(mTL,3); mTX = Text_New(NextBarSdate,NextBarStime,mid,ntostr(mid,2)); Text_SetColor(mTX,Black); Text_SetStyle(mTX,0,2); 즐거운 하루되세요 > 고도산 님이 쓴 글입니다. > 제목 : 수식 변환을 부탁드려요 > 다음 TradingView 수식을 YesTrader로 부탁드립니다. // &#169; BigBeluga //@version=6 indicator("Peak Reaction Zones [BigBeluga]", overlay = true, max_labels_count = 500, max_bars_back = 500) var high_i = int(na) var high_v = float(na) var low_i = int(na) var low_v = float(na) // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ lookback = input(72) multiplier = input.float(1, "Zones Width", step = 0.1, inline = "h/l") high_col = input.color(color.red, "", inline = "h/l") low_col = input.color(color.lime, "", inline = "h/l") // } // CALCULATIONS――――――――――{ highest = ta.highest(lookback) lowest = ta.lowest(lookback) atr = ta.atr(200) * multiplier if high[1] == highest[1] and high < highest high_i := bar_index-1 high_v := high[1] if low[1] == lowest[1] and low > lowest low_i := bar_index-1 low_v := low[1] draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } // PLOT // CALCULATIONS――――――――――{ if barstate.islast size = bar_index - (high_i > low_i ? low_i : high_i) draw_zone(high_i, high_v, true, high_col) draw_zone(low_i, low_v, false, low_col) mid = math.avg(high_v, low_v) mid_index = bar_index - size/2 line.delete(line.new(mid_index, mid, bar_index, mid, color = chart.fg_color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, mid, str.tostring(mid, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1]) for i = 0 to size index = bar_index-i-2 if low[i+3] > low_v+atr and low[i+2] < low_v+atr and high[i+1] > low_v+atr and index > low_i label.new(index, low[i+2], "", style = label.style_label_up, color = low_col, size = size.tiny) if high[i+3] < high_v-atr and high[i+2] > high_v-atr and low[i+1] < high_v-atr and index > high_i label.new(index, high[i+2], "", style = label.style_label_down, color = high_col, size = size.tiny) // }
프로필 이미지

예스스탁 예스스탁 답변

2025-03-19 13:36:57

안녕하세요 예스스탁입니다. 첨부된 그림과 같이 표시되는 식입니다. 차트에 조회봉수를 늘려보시기 바랍니다. 즐거운 하루되세요 > 고도산 님이 쓴 글입니다. > 제목 : Re : Re : 수식 변환을 부탁드려요 > 아무 것도 안보니는데요? 제가 무얼 세팅해야 하나요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환을 부탁드려요 > 안녕하세요 예스스탁입니다. input : lookback(72); input : multiplier(1); input : high_col(red); input : low_col(lime); var : hest(0),lest(0); var : alpha(0),source(0),ATRV(0),A(0); var : high_i(Nan),high_D(Nan),high_T(Nan),high_V(Nan); VAR : low_i(Nan),low_D(Nan),low_T(Nan),low_V(Nan); hest = highest(H,lookback); lest = lowest(L,lookback); alpha = 1 / 200 ; source = TrueRange; ATrV = IFf(IsNan(ATrV[1]) == true, ma(source,200) , alpha * source + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1])); A = ATRV*multiplier; if high[1] == hest[1] and high < hest Then { high_i = Index-1; high_d = sDate[1]; high_t = sTime[1]; high_v = high[1]; } if low[1] == lest[1] and low > lest Then { low_i = Index-1; low_v = low[1]; } /* draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } */ var : size(0),mid(0),mid_index(0),i(0),idx(0); var : hTL1(0),hTL2(0),hTX(0); var : lTL1(0),lTL2(0),lTX(0); var : mTL(0),mTX(0); size = index - IFf(high_i > low_i , low_i , high_i); #draw_zone(high_i, high_v, true, high_col) #draw_zone(low_i, low_v, false, low_col) TL_Delete(hTL1); TL_Delete(hTL2); Text_Delete(hTX); hTL1 = TL_New(sDate[Index-high_i],sTime[Index-high_i],high_v,NextBarSdate,NextBarStime,high_v); TL_SetColor(hTL1,high_col); TL_SetSize(hTL1,2); hTL2 = TL_New(sDate[(Index-high_i)-3],sTime[(Index-high_i)-3],high_v-A,NextBarSdate,NextBarStime,high_v-A); TL_SetColor(hTL2,high_col); TL_SetSize(hTL2,0); TL_SetStyle(hTL2,3); hTX = Text_New(NextBarSdate,NextBarStime,high_v,ntostr(high_v,2)); Text_SetColor(hTX,high_col); Text_SetStyle(hTX,0,2); TL_Delete(lTL1); TL_Delete(lTL2); Text_Delete(lTX); lTL1 = TL_New(sDate[Index-Low_i],sTime[Index-Low_i],Low_v,NextBarSdate,NextBarStime,Low_v); TL_SetColor(lTL1,Low_col); TL_SetSize(lTL1,2); lTL2 = TL_New(sDate[(Index-low_i)-3],sTime[(Index-low_i)-3],low_v+A,NextBarSdate,NextBarStime,low_v+A); TL_SetColor(lTL2,Low_col); TL_SetSize(lTL2,0); TL_SetStyle(lTL2,3); lTX = Text_New(NextBarSdate,NextBarStime,low_v,ntostr(low_v,2)); Text_SetColor(lTX,low_col); Text_SetStyle(lTX,0,2); mid = avg(high_v, low_v); mid_index = size/2; TL_Delete(mTL); Text_Delete(mTX); mTL = TL_New(sDate[mid_index],sTime[mid_index],mid,NextBarSdate,NextBarStime,mid); TL_SetColor(mTL,Black); TL_SetSize(mTL,0); TL_SetStyle(mTL,3); mTX = Text_New(NextBarSdate,NextBarStime,mid,ntostr(mid,2)); Text_SetColor(mTX,Black); Text_SetStyle(mTX,0,2); 즐거운 하루되세요 > 고도산 님이 쓴 글입니다. > 제목 : 수식 변환을 부탁드려요 > 다음 TradingView 수식을 YesTrader로 부탁드립니다. // &#169; BigBeluga //@version=6 indicator("Peak Reaction Zones [BigBeluga]", overlay = true, max_labels_count = 500, max_bars_back = 500) var high_i = int(na) var high_v = float(na) var low_i = int(na) var low_v = float(na) // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ lookback = input(72) multiplier = input.float(1, "Zones Width", step = 0.1, inline = "h/l") high_col = input.color(color.red, "", inline = "h/l") low_col = input.color(color.lime, "", inline = "h/l") // } // CALCULATIONS――――――――――{ highest = ta.highest(lookback) lowest = ta.lowest(lookback) atr = ta.atr(200) * multiplier if high[1] == highest[1] and high < highest high_i := bar_index-1 high_v := high[1] if low[1] == lowest[1] and low > lowest low_i := bar_index-1 low_v := low[1] draw_zone(x, y, h_l, color)=> dist = h_l ? -atr : atr line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1]) line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1]) // } // PLOT // CALCULATIONS――――――――――{ if barstate.islast size = bar_index - (high_i > low_i ? low_i : high_i) draw_zone(high_i, high_v, true, high_col) draw_zone(low_i, low_v, false, low_col) mid = math.avg(high_v, low_v) mid_index = bar_index - size/2 line.delete(line.new(mid_index, mid, bar_index, mid, color = chart.fg_color, style = line.style_dashed)[1]) label.delete(label.new(bar_index, mid, str.tostring(mid, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1]) for i = 0 to size index = bar_index-i-2 if low[i+3] > low_v+atr and low[i+2] < low_v+atr and high[i+1] > low_v+atr and index > low_i label.new(index, low[i+2], "", style = label.style_label_up, color = low_col, size = size.tiny) if high[i+3] < high_v-atr and high[i+2] > high_v-atr and low[i+1] < high_v-atr and index > high_i label.new(index, high[i+2], "", style = label.style_label_down, color = high_col, size = size.tiny) // }