커뮤니티

문의

프로필 이미지
레전드
2025-01-04 16:42:16
562
글번호 186871
답변완료
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // &#169; LuxAlgo //@version=5 indicator("Predictive Channels [LuxAlgo]", "LuxAlgo - Predictive Channels", overlay = true) //-----------------------------------------------------------------------------} //Settings //-----------------------------------------------------------------------------{ mult = input.float(5, 'Factor', minval = 0) slope = input.float(50, minval = 0) * mult //Style r2Css = input(#f23645, 'Upper Resistance', inline = 'resistance', group = 'Colors') r1Css = input(color.new(#f23645, 50), 'Lower', inline = 'resistance', group = 'Colors') s1Css = input(color.new(#089981, 50), 'Upper Support&#160;&#160;&#160;&#160;', inline = 'support', group = 'Colors') s2Css = input(#089981, 'Lower', inline = 'support', group = 'Colors') avgCss = input(#787b86, 'Average', group = 'Colors') areaBull = input(color.new(#089981, 80), 'Fill', inline = 'area', group = 'Colors') areaBear = input(color.new(#f23645, 80), '', inline = 'area', group = 'Colors') //-----------------------------------------------------------------------------} //Calculation //-----------------------------------------------------------------------------{ var pc_avg = close var os = 1 var hold_atr = 0. atr = nz(ta.atr(200)) * mult pc_avg := math.abs(close - pc_avg) > atr ? close : pc_avg + os * hold_atr / slope hold_atr := pc_avg == close ? atr / 2 : hold_atr os := pc_avg > pc_avg[1] ? 1 : pc_avg < pc_avg[1] ? -1 : os pc_R2 = pc_avg + hold_atr pc_R1 = pc_avg + hold_atr/2 pc_S1 = pc_avg - hold_atr/2 pc_S2 = pc_avg - hold_atr //-----------------------------------------------------------------------------} //Plot //-----------------------------------------------------------------------------{ plot_0 = plot(close, color = na, display = display.none, editable = false) //SR PLots plot(pc_R2, 'Upper Resistance', close == pc_avg ? na : r2Css) plot(pc_R1, 'Lower Resistance', close == pc_avg ? na : r1Css) plot_avg = plot(pc_avg, 'Average', close == pc_avg ? na : avgCss) plot(pc_S1, 'Upper Support', close == pc_avg ? na : s1Css) plot(pc_S2, 'Lower Support', close == pc_avg ? na : s2Css) //Fill topcss = close > pc_avg ? areaBull : color.new(chart.bg_color, 100) btmcss = close < pc_avg ? areaBear : color.new(chart.bg_color, 100) fill(plot_0, plot_avg, pc_R2, pc_S2, topcss, btmcss) 예스식으로 부탁드립니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-01-07 10:38:59

안녕하세요 예스스탁입니다. #indicator("Predictive Channels [LuxAlgo]", "LuxAlgo - Predictive Channels", overlay = true) input : mult(5); input : slope(50); var : r2Css(Red); var : r1Css(Pink); var : s1Css(Cyan); var : s2Css(Blue); var : avgCss(Gray); var : pc_avg(Close); var : os(1); var : hold_atr(0); var : mslope(0),alpha(0),a(0),ATR(0); var : pc_R2(0),pc_R1(0),pc_S1(0),pc_S2(0); mSlope = Slope*mult; alpha = 1 / 200; if CurrentBar >= 1 Then { a = iff(IsNan(a[1]) == true , ma(TrueRange, 200) , alpha * TrueRange + (1 - alpha) * iff(isnan(a[1])==true,0,a[1])); ATR = a*mult; pc_avg = iff(abs(close - pc_avg) > atr , close , pc_avg + os * hold_atr / mslope); hold_atr = iff(pc_avg == close , atr / 2 , hold_atr); os = iff(pc_avg > pc_avg[1] , 1 , IFf(pc_avg < pc_avg[1] , -1 , os)); pc_R2 = pc_avg + hold_atr; pc_R1 = pc_avg + hold_atr/2; pc_S1 = pc_avg - hold_atr/2; pc_S2 = pc_avg - hold_atr; plot1(c,"종가",Gray); plot2(pc_R2, "Upper Resistance", r2Css); plot3(pc_R1, "Lower Resistance", r1Css); plot4(pc_avg, "Average", avgCss); plot5(pc_S1, "Upper Support", s1Css); plot6(pc_S2, "Lower Support", s2Css); } 즐거운 하루되세요 > 레전드 님이 쓴 글입니다. > 제목 : 문의 > // This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // &#169; LuxAlgo //@version=5 indicator("Predictive Channels [LuxAlgo]", "LuxAlgo - Predictive Channels", overlay = true) //-----------------------------------------------------------------------------} //Settings //-----------------------------------------------------------------------------{ mult = input.float(5, 'Factor', minval = 0) slope = input.float(50, minval = 0) * mult //Style r2Css = input(#f23645, 'Upper Resistance', inline = 'resistance', group = 'Colors') r1Css = input(color.new(#f23645, 50), 'Lower', inline = 'resistance', group = 'Colors') s1Css = input(color.new(#089981, 50), 'Upper Support&#160;&#160;&#160;&#160;', inline = 'support', group = 'Colors') s2Css = input(#089981, 'Lower', inline = 'support', group = 'Colors') avgCss = input(#787b86, 'Average', group = 'Colors') areaBull = input(color.new(#089981, 80), 'Fill', inline = 'area', group = 'Colors') areaBear = input(color.new(#f23645, 80), '', inline = 'area', group = 'Colors') //-----------------------------------------------------------------------------} //Calculation //-----------------------------------------------------------------------------{ var pc_avg = close var os = 1 var hold_atr = 0. atr = nz(ta.atr(200)) * mult pc_avg := math.abs(close - pc_avg) > atr ? close : pc_avg + os * hold_atr / slope hold_atr := pc_avg == close ? atr / 2 : hold_atr os := pc_avg > pc_avg[1] ? 1 : pc_avg < pc_avg[1] ? -1 : os pc_R2 = pc_avg + hold_atr pc_R1 = pc_avg + hold_atr/2 pc_S1 = pc_avg - hold_atr/2 pc_S2 = pc_avg - hold_atr //-----------------------------------------------------------------------------} //Plot //-----------------------------------------------------------------------------{ plot_0 = plot(close, color = na, display = display.none, editable = false) //SR PLots plot(pc_R2, 'Upper Resistance', close == pc_avg ? na : r2Css) plot(pc_R1, 'Lower Resistance', close == pc_avg ? na : r1Css) plot_avg = plot(pc_avg, 'Average', close == pc_avg ? na : avgCss) plot(pc_S1, 'Upper Support', close == pc_avg ? na : s1Css) plot(pc_S2, 'Lower Support', close == pc_avg ? na : s2Css) //Fill topcss = close > pc_avg ? areaBull : color.new(chart.bg_color, 100) btmcss = close < pc_avg ? areaBear : color.new(chart.bg_color, 100) fill(plot_0, plot_avg, pc_R2, pc_S2, topcss, btmcss) 예스식으로 부탁드립니다