예스스탁
예스스탁 답변
2020-02-13 12:46:49
안녕하세요
예스스탁입니다.
input : Len(10),sentiment(3),smooth(3),vw(true),steps(5);
var : src(0),vv(0),longlen(0),upv(0),downv(0),change(0),rsiraw(0),rsiraw100(0);
var : rsiv(0),longup(0),longdown(0),longrsiraw(0),longrsiraw100(0),longrsi(0),longrsis(0),tx(0);
src = close;
vv = iff(vw, volume, 1);
longlen = sentiment * len;
change = src-src[1];
upv = wma(max(change*vv, 0), len);
downv = wma(-min(change*vv, 0), len);
rsiraw = iff(downv == 0, 100, iff(upv == 0 , 0 , 100 - (100 / (1 + upv / downv))));
rsiraw100 = rsiraw *2 -100;
rsiv = wma(rsiraw100, smooth);
longup = wma(max(change*vv, 0), longlen);
longdown = wma(-min(change*vv, 0), longlen);
longrsiraw= iff(longdown == 0 , 100 , iff(longup == 0 , 0 , 100 - (100 / (1 + longup / longdown))));
longrsiraw100 = longrsiraw *2 -100;
longrsi = wma(longrsiraw100, smooth);
longrsis = iff(steps > 0 , round(longrsi/steps,0) * steps , longrsi);
PlotBaseLine1(0,"Zero Line",YELLOW);
PlotBaseLine2(40,"Strong Upv Level",GREEN);
PlotBaseLine3(-40,"Strong Downv Level",RED);
plot1(longrsis,"Sentiment",iff(longrsis >=0 , green , red));
plot2(rsiraw100,"rsiraw100",MAGENTA);
plot3(rsiv,"K_RSI",iff(rsiv >=0 , CYAN , MAGENTA));
if rsiv < 0 and rsiv[1] >= 0 Then
{
tx = Text_New(sdate,stime,h,"▼");
Text_SetColor(tx,RED);
Text_SetStyle(tx,2,1);
Text_SetSize(tx,12);
}
if rsiv >=0 and rsiv[1] < 0 Then
{
tx = Text_New(sdate,stime,L,"▲");
Text_SetColor(tx,GREEN);
Text_SetStyle(tx,2,0);
Text_SetSize(tx,12);
}
즐거운 하루되세요
> 로즈버드 님이 쓴 글입니다.
> 제목 : 안녕하세요
> 번번히 부탁드려 죄송하고 감사합니다.
예스트레이더 수식으로 변경 문의드립니다.
//inputs
src = close
len = input(10, minval=1, title="Length")
sentiment = input(3, minval=1, title="Sentiment Factor")
smooth = input(3, minval=1, title="Smoothing")
vw = input(defval = true, title="Volume Weighted ?" )
step = input(title="Step", defval=5, maxval=50, minval=0, step=5)
//Calculations -- prefer to use wma
v = vw ? volume : 1
longlen = sentiment * len
up = wma(max(change(src)*v, 0), len)
down = wma(-min(change(src)*v, 0), len)
rsiraw= down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiraw100 = rsiraw *2 -100
rsi = wma(rsiraw100, smooth)
longup = wma(max(change(src)*v, 0), longlen)
longdown = wma(-min(change(src)*v, 0), longlen)
longrsiraw= longdown == 0 ? 100 : longup == 0 ? 0 : 100 - (100 / (1 + longup / longdown))
longrsiraw100 = longrsiraw *2 -100
longrsi = wma(longrsiraw100, smooth)
longrsis = step > 0 ? round(longrsi/step) * step : longrsi
//Plot
//Plot levels and sentiment first, so the visual order is correct - doesn't cover the main plot
zeroline = hline(0, title = 'Zero Line', color=yellow, linestyle=line)
hline(40, title = 'Strong Up Level', color=green, linestyle = dotted)
hline(-40, title = 'Strong Down Level', color=red, linestyle = dotted)
plot(longrsis, title='Sentiment',style=area , transp=20, color=longrsis >=0 ? green : red , linewidth=2)
plot(rsiraw100, color=purple)
plot(rsi, title='K_RSI',style = line , transp=20, color= rsi >=0 ? aqua : orange , linewidth=2)
SignalDn = rsi < 0 and rsi[1] >= 0
plotshape(SignalDn, title = "Signal Down", style=shape.triangledown, location = location.top, transp = 20, size=size.small, color = red, offset = -1 )
SignalUp = rsi >=0 and rsi[1] < 0
plotshape(SignalUp, title = "Signal Up", style=shape.triangleup, location = location.bottom, transp = 20, size=size.small, color = green, offset = -1 )
감사합니다.