예스스탁
예스스탁 답변
2025-05-22 10:01:37
안녕하세요
예스스탁입니다.
input : len(10);
input : FC(1);
input : SC(150);
var : Price(0),Len1(0),w(0);
var : H1(0),L1(0),N1(0);
var : H2(0),L2(0),N2(0);
var : H3(0),L3(0),N3(0);
var : dimen1(0),dimen(0),alpha1(0),oldalpha(0);
var : oldN(0),N(0),alpha_(0),alpha(0),out(0);
Price = (H+L)/2;
len1 = len/2;
w = log(2/(SC+1));
H1 = highest(high,len1);
L1 = lowest(low,len1);
N1 = (H1-L1)/len1;
H2 = highest(high,len)[len1];
L2 = lowest(low,len)[len1];
N2 = (H2-L2)/len1;
H3 = highest(high,len);
L3 = lowest(low,len);
N3 = (H3-L3)/len;
dimen1 = (log(N1+N2)-log(N3))/log(2);
dimen = iff(N1>0 and N2>0 and N3>0,dimen1,IFf(IsNan(dimen1[1])==true,0,dimen1[1]));
alpha1 = exp(w*(dimen-1));
oldalpha = iff(alpha1>1 , 1 ,IFf(alpha1<0.01 , 0.01 , alpha1));
oldN = (2-oldalpha)/oldalpha;
N = (((SC-FC)*(oldN-1))/(SC-1))+FC;
alpha_ = 2/(N+1);
alpha = iff(alpha_<2/(SC+1) , 2/(SC+1) , IFf(alpha_>1 , 1 ,alpha_));
out = (1-alpha)* iff(isnan(out[1])==true,0,out[1]) + alpha*price;
plot1(out,"FRAMA",blue);
즐거운 하루되세요
> 파생돌이 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 수고하십니다
아래수식을 예스로 부탁드립니다
//@version=2
study("Fractal Adaptive Moving Average",shorttitle="FRAMA",overlay=true)
price = input(hl2)
len = input(defval=10,minval=1)
FC = input(defval=1,minval=1)
SC = input(defval=150,minval=1)
len1 = len/2
w = log(2/(SC+1))
H1 = highest(high,len1)
L1 = lowest(low,len1)
N1 = (H1-L1)/len1
H2 = highest(high,len)[len1]
L2 = lowest(low,len)[len1]
N2 = (H2-L2)/len1
H3 = highest(high,len)
L3 = lowest(low,len)
N3 = (H3-L3)/len
dimen1 = (log(N1+N2)-log(N3))/log(2)
dimen = iff(N1>0 and N2>0 and N3>0,dimen1,nz(dimen1[1]))
alpha1 = exp(w*(dimen-1))
oldalpha = alpha1>1?1:(alpha1<0.01?0.01:alpha1)
oldN = (2-oldalpha)/oldalpha
N = (((SC-FC)*(oldN-1))/(SC-1))+FC
alpha_ = 2/(N+1)
alpha = alpha_<2/(SC+1)?2/(SC+1):(alpha_>1?1:alpha_)
out = (1-alpha)*nz(out[1]) + alpha*price
plot(out,title="FRAMA",color=blue,transp=0)