커뮤니티
TS 지표식입니다 YT 로 변환가능할까요 ?부탁드립니다.
2014-08-28 04:54:51
174
글번호 78145
힐베르트 변환지표식인데 , 제가 나름대로 고쳐봤는데 수식에서 오류가 납니다. 4번째 줄에 DETRENDPER 를 제거하면 오류는 없어지는데 지표가 출력되지 않습니다. 주기를 파악하는 지표식인데.. 부탁드립니다.
Inputs: price((H+L)/2), alpha(.07), detrendper(12);
Vars: smooth(0),cycle(0),q1(0),i1(0),deltaphase(0),phasesum(0),oldphasesum(0),
count(0),DC(0),period(0),i2(0),q2(0),alpha1(.1),series(0);
if detrendper = 0 then
series = price
else
series = price - average(price,detrendper);
smooth = (series + 2*series[1] + 2*series[2] + series[3])/6;
cycle = (1 - .5*alpha)*(1 - .5*alpha)*(smooth - 2*smooth[1] + smooth[2])
+ 2*(1 - alpha)*cycle[1] - (1 - alpha)*(1 - alpha)*cycle[2];
if currentbar < 7 then cycle = (series - 2*series[1] + series[2])/4;
q1 = (.0962*cycle + .5769*cycle[2] - .5769*cycle[4] - .0962*cycle[6])*(.5 + .8*period[1]);
i1 = cycle[3];
if q1 <> 0 and q1[1] <> 0 then deltaphase = (i1/q1 - i1[1]/q1[1])/(1 + i1*i1[1]/(q1*q1[1]));
if deltaphase < 0 then deltaphase = deltaphase[1];
if deltaphase > 1.1 then deltaphase = 1.1;
phasesum = 0;
oldphasesum = 0;
for count = 0 to 40 begin
phasesum = oldphasesum + deltaphase;
if phasesum >= 6.28318 and oldphasesum < 6.28318 then dc = count + 1;
oldphasesum = phasesum;
end;
period = .2*dc + .8*period[1];
plot1(period,"period");
답변 1
예스스탁 예스스탁 답변
2014-08-28 11:46:05
안녕하세요
예스스탁입니다.
식을 수정했습니다.
예스랭귀지에서 같다라는 표현은 ==입니다
input : alpha(0.07),detrendper(12);
var : Price(0),ii(0),series(0),smooth(0),cycle(0),q1(0),i1(0),deltaphase(0);
var : phasesum(0),oldphasesum(0),dc(0),period(0);
Price = (high+Low)/2;
if detrendper == 0 Then
series = Price;
Else
series = Price-ma(Price,detrendper);
smooth = (series+2*series[1]+2*series[2]+series[3])/6;
cycle = ((1-0.5*alpha)^2)*(smooth-2*smooth[1]+smooth[2])+2*(1-alpha)*cycle[1]-((1-alpha)^2)*cycle[2];
if CurrentBar < 7 Then
cycle = (series-2*series[1]+series[2])/4;
q1 = (0.0962*cycle+0.5769*cycle[2]-0.5769*cycle[4]-0.0962*cycle[6])*(0.5+0.8*var7);
i1 = cycle[3];
if q1 <> 0 and q1[1] <> 0 Then
deltaphase = (i1/q1-i1[1]/q1[1])/(1+i1*i1[1]/(q1*q1[1]));
if deltaphase < 0 Then deltaphase = deltaphase[1];
if deltaphase > 1.1 then deltaphase = 1.1;
phasesum = 0;
oldphasesum = 0;
for ii = 0 to 40{
phasesum = oldphasesum+deltaphase;
if phasesum >= 6.28318 and oldphasesum < 6.28318 then
dc = ii+1;
oldphasesum = phasesum;
}
period = 0.2*dc+0.8*period;
plot1(period,"Period");
즐거운 하루되세요
> ktemu10k 님이 쓴 글입니다.
> 제목 : TS 지표식입니다 YT 로 변환가능할까요 ?부탁드립니다.
>
힐베르트 변환지표식인데 , 제가 나름대로 고쳐봤는데 수식에서 오류가 납니다. 4번째 줄에 DETRENDPER 를 제거하면 오류는 없어지는데 지표가 출력되지 않습니다. 주기를 파악하는 지표식인데.. 부탁드립니다.
Inputs: price((H+L)/2), alpha(.07), detrendper(12);
Vars: smooth(0),cycle(0),q1(0),i1(0),deltaphase(0),phasesum(0),oldphasesum(0),
count(0),DC(0),period(0),i2(0),q2(0),alpha1(.1),series(0);
if detrendper = 0 then
series = price
else
series = price - average(price,detrendper);
smooth = (series + 2*series[1] + 2*series[2] + series[3])/6;
cycle = (1 - .5*alpha)*(1 - .5*alpha)*(smooth - 2*smooth[1] + smooth[2])
+ 2*(1 - alpha)*cycle[1] - (1 - alpha)*(1 - alpha)*cycle[2];
if currentbar < 7 then cycle = (series - 2*series[1] + series[2])/4;
q1 = (.0962*cycle + .5769*cycle[2] - .5769*cycle[4] - .0962*cycle[6])*(.5 + .8*period[1]);
i1 = cycle[3];
if q1 <> 0 and q1[1] <> 0 then deltaphase = (i1/q1 - i1[1]/q1[1])/(1 + i1*i1[1]/(q1*q1[1]));
if deltaphase < 0 then deltaphase = deltaphase[1];
if deltaphase > 1.1 then deltaphase = 1.1;
phasesum = 0;
oldphasesum = 0;
for count = 0 to 40 begin
phasesum = oldphasesum + deltaphase;
if phasesum >= 6.28318 and oldphasesum < 6.28318 then dc = count + 1;
oldphasesum = phasesum;
end;
period = .2*dc + .8*period[1];
plot1(period,"period");
이전글