예스스탁
예스스탁 답변
2022-11-30 14:25:09
안녕하세요
예스스탁입니다.
지표사이의 색 채우기는 지표속성에서 직접 설정하셔야 합니다.
input : lengthh(22),k(true),gain(0.7);
var : Price(0),hma(0),hma3(0),a(0),b(0),clr(0);
var : kf1(0),dk1(0),smooth1(0),velo1(0),x1(0),g1(0);
var : kf2(0),dk2(0),smooth2(0),velo2(0),x2(0),g2(0);
price = (h+l)/2;
hma = wma((2 * wma(price, lengthh / 2)) - wma(price, lengthh), round(sqrt(lengthh),0));
hma3= wma(wma(c, (lengthh/2)/3)*3 - wma(c, (lengthh/2)/2) - wma(c, (lengthh/2)), (lengthh/2));
x1 = hma;
g1 = gain;
kf1 = 0.0;
dk1 = x1 - iff(isnan(kf1[1]) == False,kf1[1], x1);
smooth1 = iff(isnan(kf1[1]) == False,kf1[1], x1)+dk1*sqrt(g1*2);
velo1 = 0.0;
velo1 = iff(isnan(velo1[1]) == False,velo1,0) + (g1*dk1);
kf1 = smooth1+velo1;
x2 = hma3;
g2 = gain;
kf2 = 0.0;
dk2 = x2 - iff(isnan(kf2[1]) == False,kf2[1], x2);
smooth2 = iff(isnan(kf2[1]) == False,kf2[1], x2)+dk2*sqrt(g2*2);
velo2 = 0.0;
velo2 = iff(isnan(velo2[1]) == False,velo2,0) + (g2*dk2);
kf2 = smooth2+velo2;
a = iff(k == true, kf1 , hma);
b = iff(k == true, kf2 , hma3);
clr = iff(b > a , lime , red);
Plot1(kf1,"a",clr);
Plot2(kf2,"b",clr);
즐거운 하루되세요
> 당일선물 님이 쓴 글입니다.
> 제목 : 지표수식 변환 요청드립니다
> 수고하십니다
예스수식으로 변환 부탁드립니다.
//==========
price = input(hl2, "Price Data (hl2)")
lengthh = input(22, "Lookback Window", minval=2)
k = input(true, "Use Kahlman?")
gain = input(.7, "Gain", minval=.0001, step=.01)
hma(x, len) => wma((2 * wma(x, len / 2)) - wma(x, len), round(sqrt(len)))
hma3(x, len) => p = len/2, wma(wma(x, p/3)*3 - wma(x, p/2) - wma(x, p), p)
kahlman(x, g) =>
kf = 0.0
dk = x - nz(kf[1], x)
smooth = nz(kf[1],x)+dk*sqrt(g*2)
velo = 0.0
velo := nz(velo[1],0) + (g*dk)
kf := smooth+velo
a = k ? kahlman(hma(price, lengthh), gain) : hma(price, lengthh)
b = k ? kahlman(hma3(close, lengthh), gain) : hma3(close, lengthh)
c = b > a ? color.red : color.lime
crossdn = a > b and a[1] < b[1]
crossup = b > a and b[1] < a[1]
fill(plot(a,color=c,linewidth=1,transp=75), plot(b,color=c,linewidth=1,transp=75), color=c, transp=55)
//===========