커뮤니티
시스템 진입조건 설정
2014-12-04 11:29:06
154
글번호 81045
항상 감사드립니다
아래 시스템식에서
1.당일 첫 진입신호는 시장가로 진입
두번째 신호부터는 현재가로 진입하되 3초내에 체결되지 않으면 시장가로 진입
2.청산은 시장가로
3.이렇게 수식을 정해놓으면 시스템매매설정과 충돌되지 않는지 궁금합니다
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Bcond1(false),Scond(false),Scond1(false),idx(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
}
Idx = idx+1;
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = c>var66 and c<var67 and var11==1 and c>var78 and c>Hma1 and c>var48 ;
Scond = c>var66 and c<var67 and var11==-1 and c<var78 and c<Lma1 and c<var48 ;
Bcond1 = c>var66 and c<var67 and var12==1 and c>var78 and c>Hma1 and c>var48 ;
Scond1 = c>var66 and c<var67 and var12==-1 and c<var78 and c<Lma1 and c<var48 ;
Condition1 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("eB_선행",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_선행",1) == true or IsExitName("StopLoss",1) == true);
Condition3 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true);
Condition4 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true);
Condition5 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("eB_거래",1) == true or IsExitName("StopLoss",1) == true);
Condition6 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_거래",1) == true or IsExitName("StopLoss",1) == true);
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entrycnt = Entrycnt+1;
if Idx >= 1 and
Start == true and
Bcond == true and
(EntryCnt == 0 or MarketPosition == -1 or (EntryCnt > 0 and MarketPosition == 0 and Condition1 == False and Condition3 == False and
Condition5 == False )) Then
buy("B1");
if Idx >= 1 and
Start == true and
Bcond1 == true and
(EntryCnt == 0 or MarketPosition == -1 or (EntryCnt > 0 and MarketPosition == 0 and Condition1 == False and Condition3 == False and
Condition5 == False )) Then
buy("B2");
if Idx >= 1 and
Start == true and
Scond == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False and Condition4 == False and
Condition6 == False )) Then
sell("S1");
if Idx >= 1 and
Start == true and
Scond1 == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False and Condition4 == False and
Condition6 == False )) Then
sell("S2");
##########################
##### 매수/매도 청산 #####
##########################
if MarketPosition == 1 and c<Cma1 and c<var48 /* and var11==-1 */ Then
exitlong("eB_선행");
if MarketPosition == -1 and c>Cma1 and c>var48 /*and var11==1 */ Then
ExitShort("eS_선행");
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*8 and c<Lma1 and c<var2 and var11==-1 Then
exitlong("eB_거래");
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*8 and c>Hma1 and c>var2 and var11==1 Then
ExitShort("eS_거래");
답변 1
예스스탁 예스스탁 답변
2014-12-04 14:42:24
안녕하세요
예스스탁입니다.
수식안에서는 주문가격을 지정하는 부분이 없습니다.
(onclose,atmarket,atstop,atlimit은 신호타입이고 주문가격을 지정하는 부분이 아닙니다.)
수식에서 지정한 조건이 충족되면 신호가 발생하고
이때 주문가격은 시스템 트레이딩 설정창의 매매가격으로 지정한 값으로 주문이 집행됩니다.
매매가격에서는 진입과 청산으로만 지정이 가능합니다.
첫번째 진입, 두번째 진입등 진입별로는 설정가능하지 않습니다.
즐거운 하루되세요
> 조민철 님이 쓴 글입니다.
> 제목 : 시스템 진입조건 설정
> 항상 감사드립니다
아래 시스템식에서
1.당일 첫 진입신호는 시장가로 진입
두번째 신호부터는 현재가로 진입하되 3초내에 체결되지 않으면 시장가로 진입
2.청산은 시장가로
3.이렇게 수식을 정해놓으면 시스템매매설정과 충돌되지 않는지 궁금합니다
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Bcond1(false),Scond(false),Scond1(false),idx(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
}
Idx = idx+1;
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = c>var66 and c<var67 and var11==1 and c>var78 and c>Hma1 and c>var48 ;
Scond = c>var66 and c<var67 and var11==-1 and c<var78 and c<Lma1 and c<var48 ;
Bcond1 = c>var66 and c<var67 and var12==1 and c>var78 and c>Hma1 and c>var48 ;
Scond1 = c>var66 and c<var67 and var12==-1 and c<var78 and c<Lma1 and c<var48 ;
Condition1 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("eB_선행",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_선행",1) == true or IsExitName("StopLoss",1) == true);
Condition3 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true);
Condition4 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true);
Condition5 = ExitDate(1) == sdate and MarketPosition(1) == 1 and
(IsExitName("eB_거래",1) == true or IsExitName("StopLoss",1) == true);
Condition6 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_거래",1) == true or IsExitName("StopLoss",1) == true);
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entrycnt = Entrycnt+1;
if Idx >= 1 and
Start == true and
Bcond == true and
(EntryCnt == 0 or MarketPosition == -1 or (EntryCnt > 0 and MarketPosition == 0 and Condition1 == False and Condition3 == False and
Condition5 == False )) Then
buy("B1");
if Idx >= 1 and
Start == true and
Bcond1 == true and
(EntryCnt == 0 or MarketPosition == -1 or (EntryCnt > 0 and MarketPosition == 0 and Condition1 == False and Condition3 == False and
Condition5 == False )) Then
buy("B2");
if Idx >= 1 and
Start == true and
Scond == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False and Condition4 == False and
Condition6 == False )) Then
sell("S1");
if Idx >= 1 and
Start == true and
Scond1 == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False and Condition4 == False and
Condition6 == False )) Then
sell("S2");
##########################
##### 매수/매도 청산 #####
##########################
if MarketPosition == 1 and c<Cma1 and c<var48 /* and var11==-1 */ Then
exitlong("eB_선행");
if MarketPosition == -1 and c>Cma1 and c>var48 /*and var11==1 */ Then
ExitShort("eS_선행");
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*8 and c<Lma1 and c<var2 and var11==-1 Then
exitlong("eB_거래");
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*8 and c>Hma1 and c>var2 and var11==1 Then
ExitShort("eS_거래");
다음글
이전글