커뮤니티
두번째 crossUp 때 신호
2011-11-07 11:38:20
367
글번호 44500
휩소제거를 위해
예로 이동 평균선이 첫 크로스업 한 후 두번째 크로스업하면 청산할려고 하는
수식을 만들어 보았는데 생각대로 잘 안되는데 뭐가 문제인지
지도해 주시면 감사하겟습니다
..............................................................................................
if marketposition==1 and countif(CrossDown(cc[1],bb[1]),40)>=1
then kk=kk+1;
if kk==1 and CrossDown(cc,bb) then {exitlong("xb");
kk=0 ;}
...
.....
if marketposition==-1 and countif(CrossUp(cc[1],bb[1]),40)>=1
then kk=kk-1;
if kk==-1 and CrossUp(cc,bb) then{ exitshort("xs");
kk=0;}
답변 2
예스스탁 예스스탁 답변
2011-11-07 16:26:34
안녕하세요
예스스탁입니다.
작성하신 식은 40봉안에 crossup이나 crossdown인 일어나면
무조건 카운트가 되므로 진입이후의 크로스만 판단하는 식이 아닙니다.
아래와 같이 간단히 작성하시면 됩니다.
if MarketPosition == 1 and CrossDown(cc,bb) and countif(CrossDown(cc,bb),dayindex+1) == 2 Then
exitlong();
if MarketPosition == -1 and CrossUp(cc,bb) and countif(CrossUp(cc,bb),dayindex+1) == 2 Then
exitshort();
즐거운 하루되세요
> ghkim 님이 쓴 글입니다.
> 제목 : 두번째 crossUp 때 신호
> 휩소제거를 위해
예로 이동 평균선이 첫 크로스업 한 후 두번째 크로스업하면 청산할려고 하는
수식을 만들어 보았는데 생각대로 잘 안되는데 뭐가 문제인지
지도해 주시면 감사하겟습니다
..............................................................................................
if marketposition==1 and countif(CrossDown(cc[1],bb[1]),40)>=1
then kk=kk+1;
if kk==1 and CrossDown(cc,bb) then {exitlong("xb");
kk=0 ;}
...
.....
if marketposition==-1 and countif(CrossUp(cc[1],bb[1]),40)>=1
then kk=kk-1;
if kk==-1 and CrossUp(cc,bb) then{ exitshort("xs");
kk=0;}
ghkim
2011-11-08 18:48:18
ghkim 님에 의해 삭제된 답변입니다.