예스스탁
예스스탁 답변
2025-06-10 21:00:14
안녕하세요
예스스탁입니다.
식 2개가 Y축이 다릅니다.
각각 작성해 적용하셔야 합니다.
1
input : length(14);
input : smoType1(3); #1:EMA, 2:SMA, 3:RMA, 4TMA
input : arsiCss(silver);
input : autoCss(true);
//Signal Line
input : smooth(14);
input : smoType2(1);#1EMA, 2SMA, 3RMA, 4TMA
input : signalCss(Orange);
//OB/OS Style
input : obValue(80);
input : obCss(Green);
input : obAreaCss(LightGreen);
input : osValue(20);
input : osCss(Red);
input : osAreaCss(LightRed);
var : src(0);
var : upper(0),lower(0),r(0);
var : d(0),diff(0),alpha(0),num(0),den(0),arsi(0),signal(0),a(0),tx(0);
src = close;
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]));
}
if smoType1 == 4 Then
{
num = ma(ma(diff, length),length);
den = ma(ma(abs(diff), length), length);
}
arsi = num / den * 50 + 50;
if smoType2 == 1 Then
{
signal = ema(arsi, smooth);
}
if smoType2 == 2 Then
{
signal = ma(arsi, smooth);
}
if smoType2 == 3 Then
{
a = 1/smooth;
signal = iff(isnan(signal[1]) == true, ma(arsi, length) , a * arsi + (1 - a) * iff(isnan(signal[1])==true,0,signal[1]));
}
if smoType2 == 4 Then
{
signal = ma(arsi, smooth);
}
plot1(arsi, "Ultimate RSI",IFf(arsi > obValue , obCss , IFF(arsi < osValue , osCss ,IFf( autoCss , Black , arsiCss))));
plot2(signal, "Signal Line", signalCss);
PlotBaseLine1(obValue, "Overbought");
PlotBaseLine2(50, "Midline");
PlotBaseLine3(osValue, "Oversold");
2
//=== Supertrend 추가 ===
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(0);#0:true, 1: false
var : ATR2(0),ap(0),ATR1(0),ATRV(0);
var : super_src(0),up(0),up1(0),dn(0),dn1(0),trend(0);
atr2 = ma(TrueRange, periods);
ap = 1 / periods ;
ATR1 = IFf(IsNan(ATR1[1]) == true, ma(TrueRange,periods) , ap * TrueRange + (1 - ap) * IFf(isnan(ATR1[1])==true,0,ATR1[1]));
atrv = iff(changeATR , ATR1 , atr2);
super_src = (h+l)/2;
up = super_src - Multiplier * atrv;
up1 = iff(isnan(up[1]) == true, up,up[1]);
up = iff(close[1] > up1 , max(up, up1) , up);
dn = super_src + Multiplier * atrv;
dn1 = iff(isnan(dn[1]) == true, dn,dn[1]);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = IFf(IsNan(trend[1]) == true, trend,trend[1]);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot3(up,"up trend");
Else
NoPlot(3);
if trend == -1 Then
plot4(dn,"down trend");
Else
NoPlot(4);
즐거운 하루되세요
> 파생돌이 님이 쓴 글입니다.
> 제목 : 부틱드립니다
> 수고하십니다
아래수식을 예스로 부탁드립니다
//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