커뮤니티

부탁드립니다

프로필 이미지
파생돌이
2025-04-23 14:41:16
330
글번호 190364
답변완료
수고하십니다 아래의 트레이딩뷰 수식을 예스트레이더 수식으로 부탁드립니다 //Settings //-----------------------------------------------------------------------------{ length = input.int(70, minval = 2) smoType1 = input.string('RMA', 'MA type', options = ['EMA', 'SMA', 'RMA']) src = input(close, 'Source') rsiPCss = input(color.rgb(212, 0, 180), 'Color', inline = 'rsicss') autoCss = input(true, 'Auto', inline = 'rsicss') //Signal Line smooth = input.int(50, minval = 1, group = 'Signal') smoType2 = input.string('SMA', 'Method', options = ['EMA', 'SMA'], group = 'Signal') signalCss = input(#ffd900, 'Color', group = 'Signal') //OB/OS Style obValue = input.float(90, '매수', inline = 'ob', group = 'OB/OS Style') obCss = input(color.rgb(0, 188, 135, 22), '', inline = 'ob', group = 'OB/OS Style') obAreaCss = input(color.new(#436264, 84), '', inline = 'ob', group = 'OB/OS Style') osValue = input.float(10, '매도????', inline = 'os', group = 'OB/OS Style') osCss = input(#da0012, '', inline = 'os', group = 'OB/OS Style') osAreaCss = input(color.new(#90595e, 86), '', inline = 'os', group = 'OB/OS Style') //-----------------------------------------------------------------------------} //Functions //-----------------------------------------------------------------------------{ ma(x, len, maType)=> switch maType 'EMA' => ta.ema(x, len) 'SMA' => ta.sma(x, len) 'RMA' => ta.rma(x, len) //-----------------------------------------------------------------------------} //Augmented RSI //-----------------------------------------------------------------------------{ upper = ta.highest(src, length) lower = ta.lowest(src, length) r = upper - lower d = src - src[1] diff = upper > upper[1] ? r : lower < lower[1] ? -r : d num = ma(diff, length, smoType1) den = ma(math.abs(diff), length, smoType1) rsiP = num / den * 70 + 70 signal = ma(rsiP, smooth, smoType2) //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ plot_rsi = plot(rsiP, title = 'RSI ', color = rsiP > obValue ? obCss : rsiP < osValue ? osCss : autoCss ? chart.fg_color : rsiPCss, linewidth = 2) // 선 두께 plot(signal, title = 'Signal Line', color = signalCss, linewidth = 2) // 신호선 //Levels plot_up = plot(obValue, color = na, editable = false, linewidth = 2) plot_avg = plot(50, color = na, editable = false, linewidth = 2) plot_dn = plot(osValue, color = na, editable = false, linewidth = 2) //OB-OS fill(plot_rsi, plot_up, rsiP > obValue ? obAreaCss : na) fill(plot_dn, plot_rsi, rsiP < osValue ? osAreaCss : na) //Gradient fill(plot_rsi, plot_avg, obValue, 50, obAreaCss, color.new(chart.bg_color, 100)) fill(plot_avg, plot_rsi, 50, osValue, color.new(chart.bg_color, 100), osAreaCss) hline(obValue, 'Overbought') hline(50, 'Midline') hline(osValue, 'Oversold') //-----------------------------------------------------------------------------}
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-04-24 09:54:43

안녕하세요 예스스탁입니다. input : length(70); input : smoType1(3); #1:EMA,2:SMA, 3:RMA input : src(close); input : rsiPCss(Violet); input : autoCss(true); input : smooth(50); input : smoType2(2); #1:EMA, 2:SMA input : signalCss(Gold); input : obValue(90); input : obCss(Teal); input : obAreaCss(Navy); input : osValue(10); input : osCss(Red); input : osAreaCss(Brown); var : upper(0),lower(0),r(0),d(0),diff(0),num(0),den(0),rsiP(0),signal(0); var : alpha(0); upper = highest(src, length); lower = lowest(src, length); r = upper - lower; d = src - src[1]; diff = iff(upper > upper[1] , r ,IFF(lower < lower[1] , -r , d)); if smoType1 == 1 Then { num = ema(diff, length); den = ema(abs(diff), length); } if smoType1 == 2 Then { num = ma(diff, length); den = ma(abs(diff), length); } if smoType1 == 3 Then { alpha = 1/length; num = iff(IsNaN(num[1]) == true , ma(diff, length) , alpha * diff + (1 - alpha) * iff(isnan(num[1])==true,0,num[1])); den = iff(IsNaN(den[1]) == true , ma(abs(diff), length) , alpha * abs(diff) + (1 - alpha) * iff(isnan(den[1])==true,0,den[1])); } rsiP = num / den * 70 + 70; if smoType2 == 1 Then { signal = ema(rsiP, smooth); } if smoType2 == 2 Then { signal = ma(rsiP, smooth); } plot1(rsiP, "RSI",IFF(rsiP > obValue , obCss ,IFF(rsiP < osValue , osCss ,IFF(autoCss ,Black,rsiPCss)))); plot2(signal,"Signal Line",signalCss); plot3(obValue,"up"); plot4(50,"avg"); plot5(osValue,"dn"); PlotBaseLine1(obValue, "Overbought"); PlotBaseLine2(50, "Midline"); PlotBaseLine3(osValue, "Oversold"); 즐거운 하루되세요 > 파생돌이 님이 쓴 글입니다. > 제목 : 부탁드립니다 > 수고하십니다 아래의 트레이딩뷰 수식을 예스트레이더 수식으로 부탁드립니다 //Settings //-----------------------------------------------------------------------------{ length = input.int(70, minval = 2) smoType1 = input.string('RMA', 'MA type', options = ['EMA', 'SMA', 'RMA']) src = input(close, 'Source') rsiPCss = input(color.rgb(212, 0, 180), 'Color', inline = 'rsicss') autoCss = input(true, 'Auto', inline = 'rsicss') //Signal Line smooth = input.int(50, minval = 1, group = 'Signal') smoType2 = input.string('SMA', 'Method', options = ['EMA', 'SMA'], group = 'Signal') signalCss = input(#ffd900, 'Color', group = 'Signal') //OB/OS Style obValue = input.float(90, '매수', inline = 'ob', group = 'OB/OS Style') obCss = input(color.rgb(0, 188, 135, 22), '', inline = 'ob', group = 'OB/OS Style') obAreaCss = input(color.new(#436264, 84), '', inline = 'ob', group = 'OB/OS Style') osValue = input.float(10, '매도????', inline = 'os', group = 'OB/OS Style') osCss = input(#da0012, '', inline = 'os', group = 'OB/OS Style') osAreaCss = input(color.new(#90595e, 86), '', inline = 'os', group = 'OB/OS Style') //-----------------------------------------------------------------------------} //Functions //-----------------------------------------------------------------------------{ ma(x, len, maType)=> switch maType 'EMA' => ta.ema(x, len) 'SMA' => ta.sma(x, len) 'RMA' => ta.rma(x, len) //-----------------------------------------------------------------------------} //Augmented RSI //-----------------------------------------------------------------------------{ upper = ta.highest(src, length) lower = ta.lowest(src, length) r = upper - lower d = src - src[1] diff = upper > upper[1] ? r : lower < lower[1] ? -r : d num = ma(diff, length, smoType1) den = ma(math.abs(diff), length, smoType1) rsiP = num / den * 70 + 70 signal = ma(rsiP, smooth, smoType2) //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ plot_rsi = plot(rsiP, title = 'RSI ', color = rsiP > obValue ? obCss : rsiP < osValue ? osCss : autoCss ? chart.fg_color : rsiPCss, linewidth = 2) // 선 두께 plot(signal, title = 'Signal Line', color = signalCss, linewidth = 2) // 신호선 //Levels plot_up = plot(obValue, color = na, editable = false, linewidth = 2) plot_avg = plot(50, color = na, editable = false, linewidth = 2) plot_dn = plot(osValue, color = na, editable = false, linewidth = 2) //OB-OS fill(plot_rsi, plot_up, rsiP > obValue ? obAreaCss : na) fill(plot_dn, plot_rsi, rsiP < osValue ? osAreaCss : na) //Gradient fill(plot_rsi, plot_avg, obValue, 50, obAreaCss, color.new(chart.bg_color, 100)) fill(plot_avg, plot_rsi, 50, osValue, color.new(chart.bg_color, 100), osAreaCss) hline(obValue, 'Overbought') hline(50, 'Midline') hline(osValue, 'Oversold') //-----------------------------------------------------------------------------}