커뮤니티
하단채널이 시작할때의 직전 상단채널의 1봉전 값을 일직선 선분으로
input:swingperiod(2),ATrperiod(10),ATrmult(2.5);
var:PH(0),PL(0),LASTPP(0),center(0),alpha(0),source(0),ATrv(0);
var:upch(0),dnch(0),trend(0),tup(0),tdown(0),trallingsl(0);
#스윙하이와 스윙로우를 이용하여 중심선계산
ph=swinghigh(1,max(c,o),swingperiod,swingperiod,swingperiod*2+1);
pl=swinglow(1,min(c,o),swingperiod,swingperiod,swingperiod*2+1);
if ph<> -1 Then lastpp=ph;
if pl<> -1 Then lastpp=pl;
if ph<> -1 or pl<> -1 Then center=(center*2 + lastpp)/3;
#ATr계산(true Range를 rma로 평균)
if CurrentBar > 0 Then {
alpha = 1/ATrperiod;
source= max(h-l,abs(h-c[1]),abs(l-c[1]));
ATrv=alpha*source +(1- alpha)*ATrv[1];}
#상하단 채널과 추세에따른 추세채널
upch=center -(ATrmult*ATrv);
dnch=center +(ATrmult*ATrv);
tup= IFf(c[1]>tup[1],max(upch,tup[1]),upch);
tdown=IFf(c[1]<tdown[1],min(dnch,tdown[1]),dnch);
if c>tdown[1] Then trend=1;
if c<tup[1] Then trend=-1;
trallingsl= iff (trend ==1,tup,tdown);
if c> trallingsl Then {
Plot1(trallingsl,"uptren",Red,Def,2);
noPlot(2);
}
Else{
plot2(trallingsl,"dntrend",Black,Def,2);
NoPlot(1);
}
하단 채널이 시작 되는날 상단채널의 마지막 지표값만 일직선으로 우측으로 가는 선분을 한가닥만 보이도록 부탁 드려요 . 꾸벅 .
답변 3
예스스탁 예스스탁 답변
2026-10-14 15:47:39
생각하는허수아비
2026-10-14 17:22:48
예스스탁 예스스탁 답변
2026-10-14 17:34:00