답변완료
부틱드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
//settings
length = input.int(14,minval = 2)
smoType1 = input.string('RMA','Method',options = ['EMA','SMA','RMA','TMA'])
src = input(close,'Source')
arsiCss = input(color_silver,'color',inline = 'rsicss')
autoCss = input(true,'Auto',inline = 'rsicss')
//signal line
smooth = input.int(14,minval = 1,group = 'Signal Line')
smoType2 = input.string('EMA','Method',options = ['EMA','SMA','RMA','TMA'], group = 'Signal Line')
signalCss = input( #ff5d00,'Color',group = 'Signal Line')
//OB/OS Style
obValue = input.FLoat(80,'Overbought',inline = 'ob', group = 'OB/OS Style')
obCss = input( #089981,'', inline = 'ob', group = 'OB/OS Style')
obAteaCss = input( color_new(#089981, 80),'',inline = 'ob', group = 'OB/OS Style')
osValue = input.FLoat(20, 'Oversold ',inline = 'os', group = 'OB/OS Style')
osCss = input( #f23645,'', inline = 'os', group = 'OB/OS Style')
osAreaCss = input( color_new(#f23645, 80),'',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)
'TMA' => ta.sma(ta.sma(x, len), 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)
arsi = num / den *50 + 50
signal = ma(arsi,smooth,smoType2)
//Plots
plot_rsi = plot(arsi,'Ultimate RSI'
,arsi > obvalue ? obCss
:arsi < osvalue ? osCss
:autoCss ? chart.fg_color : arsiCss)
plot(signal,'signal Line',signalCss)
//Levels
plot_up = plot(obvalue,color = na, editable = false)
plot_avg = plot(50, color = na, editable = false)
plot_dn = plot(osvalue, color = na, editable = false)
//OB-OS
fill(plot_rsi, plot_up, arsi > obvalue ? obAreaCss : na)
fill(plot_dn, plot_rsi, arsi < 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')
//=== Supertrend 추가 ===
Periods = input.int(10, title ="ATR Period")
Multiplier = input.float(3.0, step=0.1,title ="ATR Multiplier")
changeATR = input.bool(true,title="change ATR Calculation Method ?")
atr2 = ta.sma(ta.tr, periods)
atr = changeATR ? ta.atr(Periods) : atr2
super_src = hl2
up = super_src - Multiplier * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? math.max(up, up1) : up
dn = super_src + Multiplier * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
plot(trend == 1 ? up : na, title ="up trend", style = plot.styie_linebr, 1
plot(trend == -1 ? dn : na, title ="down trend", style = plot.styie_linebr ,1
2025-06-09
226
글번호 191554
지표