커뮤니티

하단채널이 시작할때의 직전 상단채널의 1봉전 값을 일직선 선분으로

프로필 이미지
생각하는허수아비
2026-10-14 09:07:19
89
글번호 233879
답변완료

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

안녕하세요 예스스탁입니다. 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),lastupvalue(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 trend == 1 and trend != trend[1] Then lastupvalue = trallingsl[1]; if c> trallingsl Then { Plot1(trallingsl,"uptren",Red,Def,2); Plot3(lastupvalue,"마지막상단값"); noPlot(2); } Else{ plot2(trallingsl,"dntrend",Black,Def,2); NoPlot(1); NoPlot(3); } 즐거운 하루되세요
프로필 이미지

생각하는허수아비

2026-10-14 17:22:48

추가 질문 하나만 더 요청 드립니다.
하단선이 (빨간라인) 발생하는 당일을 종목검색으로 찾으려면 어떻게 하나요 .
if 문 문장만 만들어 주세요 .
다시한번 감사 드립니다.
프로필 이미지

예스스탁 예스스탁 답변

2026-10-14 17:34:00

안녕하세요 예스스탁입니다. 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),lastupvalue(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 trend == 1 and trend != trend[1] Then find(1); 즐거운 하루되세요