커뮤니티
매수조건 완성시 주문이 안나가요
2008-12-23 14:18:35
613
글번호 18966
var : cnt(0),count(0), value(0);
setstoptrailing(0.4,1.3,pointstop);//청산기준
setstopendofday(1500);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy();
if stime >=093000 and ma(C,4) < ma(C,20) then
sell();
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 2 and MarketPosition(1) == -1 and ma(C,4) > ma(C,20) then
buy();
if BarsSinceExit(1) == 2 and MarketPosition(1) == 1 and ma(C,4) < ma(C,20) then
sell();
}
이식인데
여기서 트레일링 스탑을 빼면 정상적으로 신호 발생해서 주문이 나갑니다
그런데 트레일링스탑을 넣으면 트레이일링스탑이후 매수/매도 조건 발생시 주문이
안나갑니다^^;
매번 감사합니다~
답변 1
예스스탁 예스스탁 답변
2008-12-23 19:37:29
안녕하세요
예스스탁입니다.
원식이 청산후 반대방향으로 진입이므로
청산후에는 반대진입만 가능하게 식이 작성되어 있습니다.
트레일링 스탑을 포함해 청산 후에 2번째 봉에서 진입하게 되어 잇는데
청산 후 2번째 봉에서 전진입과 반대방향 조건이 만족하지 않으면
진입하지 않습니다.
청산 후 2봉 경과후에 무조건 반대방향으로 진입하게 식을 수정했습니다.
var : cnt(0),count(0), value(0);
setstoptrailing(0.4,1.3,pointstop);//청산기준
setstopendofday(1500);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy("b");
if stime >=093000 and ma(C,4) < ma(C,20) then
sell("s");
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 2 and MarketPosition(1) == -1 then
buy("b1");
if BarsSinceExit(1) == 2 and MarketPosition(1) == 1 then
sell("s1");
}
즐거운 하루되세요
> 반포동 님이 쓴 글입니다.
> 제목 : 매수조건 완성시 주문이 안나가요
> var : cnt(0),count(0), value(0);
setstoptrailing(0.4,1.3,pointstop);//청산기준
setstopendofday(1500);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy();
if stime >=093000 and ma(C,4) < ma(C,20) then
sell();
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 2 and MarketPosition(1) == -1 and ma(C,4) > ma(C,20) then
buy();
if BarsSinceExit(1) == 2 and MarketPosition(1) == 1 and ma(C,4) < ma(C,20) then
sell();
}
이식인데
여기서 트레일링 스탑을 빼면 정상적으로 신호 발생해서 주문이 나갑니다
그런데 트레일링스탑을 넣으면 트레이일링스탑이후 매수/매도 조건 발생시 주문이
안나갑니다^^;
매번 감사합니다~