커뮤니티
수식어를 부탁합니다
2003-12-02 16:29:20
4539
글번호 1540
1.다음식은 매매식입니다
동식에 의거 매수신호가 발생한후 이동평균선(20)이 양선일경우 매수청산을 보류
할수 있는 식을 부탁합니다.(매도신호가 발생한후 이동평균선이 음선일경우
매도청산을 보류할수 있는 식도 포함)
input:P1(1);
var:SUMv(0),MAV(0);
var:AB(0);
SUMV=0;
FOR AB =1 to P1
SUMV=SUMV+DAYCLOSE(AB);
MAV= SUMV/P1;
if CROSSUP(CLOSE,MAV)then{
ExitShort();
Buy();
}
if CrossDown(CLOSE,MAV)then{
ExitLong();
Sell();
}
2.매도,매수청산을 보류할수 없다면 청산식을 이평평균선(25)이 양,음선일때하고 싶은데 동식을 부탁합니다.
답변 1
예스스탁 예스스탁 답변
2003-12-03 13:31:12
안녕하세요? 예스스탁입니다....
문의하신 내용 중에서 이동평균선의 양선 혹은 음선의 의미를 답변자가 이동평균선이 전봉대비 상승 혹은 하락으로 이해 했다면 다음과 같이 식을 작성하시면 될 것입니다.
input:P1(1);
var:SUMv(0),MAV(0);
var:AB(0), 매수식(0), 매도식(0), bcnt(0), scnt(0), buypos(0), sellpos(0);
SUMV=0;
FOR AB =1 to P1
SUMV=SUMV+DAYCLOSE(AB);
MAV= SUMV/P1; //분봉에서 일봉의 이평
if CrossUP(CLOSE,MAV) and ma(C, 20) > ma(C[1], 20) then //매도청산조건
sellpos = 0;
if CROSSDown(CLOSE,MAV) and ma(C, 20) < ma(C[1], 20) then //매수청산조건
buypos = 0;
if CrossUP(CLOSE,MAV) then //매수조건
buypos=1;
if CROSSDown(CLOSE,MAV) then // 매도조건
sellpos = -1;
if dayindex()==0 then {
buypos = 0;
sellpos = 0;
}
if (buypos == 1 and buypos[1] == 0 and sellpos == 0) or
(sellpos == 0 and sellpos[1] == -1 and buypos == 1) then
buy();
if (sellpos == -1 and sellpos[1] == 0 and buypos == 0) or
(buypos == 0 and buypos[1] == 1 and sellpos == -1) then
sell();
if (buypos == 1 and sellpos[1] == 0 and sellpos == -1) or
(buypos == 0 and buypos[1] == 1 and sellpos == 0) then
exitlong();
if (buypos == 0 and sellpos[1] == -1 and sellpos == 0) or
(buypos == 1 and buypos[1] == 0 and sellpos == -1) then
exitshort();
즐거운 하루 되세요...
> 어머니 님이 쓴 글입니다.
> 제목 : 수식어를 부탁합니다
> 1.다음식은 매매식입니다
동식에 의거 매수신호가 발생한후 이동평균선(20)이 양선일경우 매수청산을 보류
할수 있는 식을 부탁합니다.(매도신호가 발생한후 이동평균선이 음선일경우
매도청산을 보류할수 있는 식도 포함)
input:P1(1);
var:SUMv(0),MAV(0);
var:AB(0);
SUMV=0;
FOR AB =1 to P1
SUMV=SUMV+DAYCLOSE(AB);
MAV= SUMV/P1;
if CROSSUP(CLOSE,MAV)then{
ExitShort();
Buy();
}
if CrossDown(CLOSE,MAV)then{
ExitLong();
Sell();
}
2.매도,매수청산을 보류할수 없다면 청산식을 이평평균선(25)이 양,음선일때하고 싶은데 동식을 부탁합니다.
다음글
이전글