커뮤니티

문의 드립니다

프로필 이미지
야할라
2023-12-06 08:02:45
730
글번호 174607
답변완료
input: length(21),hh(8),mult(2),k(2); var: src(0),n(0),tx(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0); src = close; n = BarIndex; sum = 0; For i = 0 to length-1 { sum = 0; sumw =0; For j = 0 to length-1 { w = exp(-(pow(i-j,2)/(hh*hh*2))); sum = sum+src[j]*w; sumw = sumw+w; } y2 = sum/sumw; sume = sume+abs(src[i]-y2); } mae = sume/length*mult; if CrossDown(src,y2+mae) Then { tx = text_new(sDate,sTime,h,"▼"); Text_SetStyle(tx,2,1); Text_Setcolor(tx,red); } if Crossup(src,y2-mae) Then { tx = text_new(sDate,sTime,l,"▲"); Text_SetStyle(tx,2,0); Text_Setcolor(tx,green); } Plot1(y2,"상한",Red); plot2(y2+mae,"중심",Black); plot3(y2-mae,"하한",blue); 위 수식에서 plot2와 plot3 가 나오지 않습니다 mae를 구하는 수식에서 문제가 있는 것 같은데 좀 확인해 주시길 바랍니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-12-06 14:01:21

안녕하세요 예스스탁입니다. input: length(21),hh(8),mult(2),k(2); var: src(0),n(0),tx(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0); src = close; n = BarIndex; sume = 0; For i = 0 to length-1 { sum = 0; sumw =0; For j = 0 to length-1 { w = exp(-(pow(i-j,2)/(hh*hh*2))); sum = sum+src[j]*w; sumw = sumw+w; } y2 = sum/sumw; sume = sume+abs(src[i]-y2); } mae = sume/length*mult; if CrossDown(src,y2+mae) Then { tx = text_new(sDate,sTime,h,"▼"); Text_SetStyle(tx,2,1); Text_Setcolor(tx,red); } if Crossup(src,y2-mae) Then { tx = text_new(sDate,sTime,l,"▲"); Text_SetStyle(tx,2,0); Text_Setcolor(tx,green); } Plot1(y2,"상한",Red); plot2(y2+mae,"중심",Black); plot3(y2-mae,"하한",blue); 즐거운 하루되세요 > 야할라 님이 쓴 글입니다. > 제목 : 문의 드립니다 > input: length(21),hh(8),mult(2),k(2); var: src(0),n(0),tx(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0); src = close; n = BarIndex; sum = 0; For i = 0 to length-1 { sum = 0; sumw =0; For j = 0 to length-1 { w = exp(-(pow(i-j,2)/(hh*hh*2))); sum = sum+src[j]*w; sumw = sumw+w; } y2 = sum/sumw; sume = sume+abs(src[i]-y2); } mae = sume/length*mult; if CrossDown(src,y2+mae) Then { tx = text_new(sDate,sTime,h,"▼"); Text_SetStyle(tx,2,1); Text_Setcolor(tx,red); } if Crossup(src,y2-mae) Then { tx = text_new(sDate,sTime,l,"▲"); Text_SetStyle(tx,2,0); Text_Setcolor(tx,green); } Plot1(y2,"상한",Red); plot2(y2+mae,"중심",Black); plot3(y2-mae,"하한",blue); 위 수식에서 plot2와 plot3 가 나오지 않습니다 mae를 구하는 수식에서 문제가 있는 것 같은데 좀 확인해 주시길 바랍니다