커뮤니티
시스템 시간설정 조정
2014-11-26 13:48:11
175
글번호 80777
항상 감사드립니다
1.국내선물
아래시스템에서 장종료시간을 15:00 로 하고 당일매수청산을 15:00으로 하면 전일발생신호봉에 상관없이 아침 첫신호는 정상적으로 발생합니다
그런데 장종료시간을 12:30 으로 설정하면 12:30이후에도 신호가 발생하고 당일 마지막신호에따라
다음날 첫신호가 반대신호만 나옵니다..
수정부탁드립니다
##################################################
##### 당일 09:00 장시작 / 당일 12:30 장종료 #####
##################################################
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = entrycnt+1;
Idx = 0;
}
Idx = idx+1;
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = var11==1 and c>var78 and c>Hma1 ;
Scond = var11==-1 and c<var78 and c<Lma1 ;
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);
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 )) Then
buy("B1");
if Idx >= 1 and
Start == true and
Scond == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False )) Then
sell("S1");
##########################
##### 매수/매도 청산 #####
##########################
if MarketPosition == 1 and c<Cma1 and c<var48 Then
exitlong("eB_선행");
if MarketPosition == -1 and c>Cma1 and c>var48 Then
ExitShort("eS_선행");
##손절_1_20틱 자동손절##
SetStopLoss(PriceScale*20,PointStop);
###############################
##### 매일 12:30 강제청산 #####
###############################
if stime == 123000 or (stime > 123000 and stime[1] < 123000) Then{
exitlong("당일매수청산");
ExitShort("당일매도청산");
}
2.해외선물
아래시스템식은 첫신호를 발생시키지 않는 시스템식입니다
제가 발생시키고자하는 신호는 B2,S2 인데 S11,B11 신호가 발생합니다
수정부탁드립니다
##################################################
##### 당일 08:00 장시작 / 익일 04:30 장종료 #####
##################################################
input : 시작시간(080000),끝시간(043000);
var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
Ventry = 0;
Vposition = 0;
Vprice = 0;
MessageLog("%.2f",entrycnt);
}
Idx = idx+1;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then{
Entrycnt = entrycnt+1;
MessageLog("%.2f",entrycnt);
}
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = /*c>var77 and c<var79 and */ c>Hma1 and c>var78 and var58==1 and cma1>var78 ;
Scond = /*c>var77 and c<var79 and */ c<Lma1 and c<var78 and var58==-1 and cma1<var78 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB100",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS100",1) == true or IsExitName("StopLoss",1) == true);
if Ventry == 0 and
Idx >= 1 and
Start == true and
Bcond == true Then{
Ventry = 1;
Vposition = 1;
VPrice = C;
}
if Ventry == 0 and
Idx >= 1 and
Start == true and
Scond == true Then{
Ventry = 1;
Vposition = -1;
Vprice = C;
}
if Ventry != 0 Then{
if Vposition == 1 and L <= Vprice-PriceScale*30 Then
Ventry = 2;
if Vposition == -1 and H >= Vprice+PriceScale*30 Then
Ventry = 2;
}
if Idx >= 1 and
Start == true and
Bcond == true Then{
if Entrycnt == 0 and Ventry == 1 and Vposition == -1 Then
buy("B11");
if Entrycnt == 0 and Ventry == 2 and Vposition != 1 Then
buy("B12");
if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False ))) Then{
buy("B2");
}
}
if Idx >= 1 and
Start == true and
Scond == true then{
if Entrycnt == 0 and Ventry == 1 and Vposition == 1 Then
sell("S11");
if Entrycnt == 0 and Ventry == 2 and Vposition != -1 Then
sell("S12");
if (Entrycnt >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False ))) Then{
sell("S2");
}
}
감사합니다
답변 1
예스스탁 예스스탁 답변
2014-11-26 15:26:01
안녕하세요
예스스탁입니다.
1.
시작시간에 entrycnt의 값이 잘못저장되어 있었습니다.
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Scond(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 > ma(H,20);#var11==1 and c>var78 and c>Hma1 ;
Scond = C < ma(L,20);#var11==-1 and c<var78 and c<Lma1 ;
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);
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 )) Then
buy("B1");
if Idx >= 1 and
Start == true and
Scond == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False )) Then
sell("S1");
##########################
##### 매수/매도 청산 #####
##########################
var : cma1(0);
cma1 = ma(C,20);
var48 = ma(c,60);
if MarketPosition == 1 and c<Cma1 and c<var48 Then
exitlong("eB_선행");
if MarketPosition == -1 and c>Cma1 and c>var48 Then
ExitShort("eS_선행");
##손절_1_20틱 자동손절##
SetStopLoss(PriceScale*20,PointStop);
###############################
##### 매일 12:30 강제청산 #####
###############################
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then{
exitlong("당일매수청산");
ExitShort("당일매도청산");
}
2.
해당식은 첫신호를 없애고 케이스별로 진입을 합니다.
주문함수가 늘어나면서 주문함수 별로 동일이름을 사용할수 없어 이름을 따로 지정한 것입니다.
or로 묶어 하나의 이름으로만 나오게 수정해 드립니다.
input : 시작시간(080000),끝시간(043000);
var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
Ventry = 0;
Vposition = 0;
Vprice = 0;
MessageLog("%.2f",entrycnt);
}
Idx = idx+1;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then{
Entrycnt = entrycnt+1;
MessageLog("%.2f",entrycnt);
}
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = /*c>var77 and c<var79 and */ c>Hma1 and c>var78 and var58==1 and cma1>var78 ;
Scond = /*c>var77 and c<var79 and */ c<Lma1 and c<var78 and var58==-1 and cma1<var78 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB100",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS100",1) == true or IsExitName("StopLoss",1) == true);
if Ventry == 0 and
Idx >= 1 and
Start == true and
Bcond == true Then{
Ventry = 1;
Vposition = 1;
VPrice = C;
}
if Ventry == 0 and
Idx >= 1 and
Start == true and
Scond == true Then{
Ventry = 1;
Vposition = -1;
Vprice = C;
}
if Ventry != 0 Then{
if Vposition == 1 and L <= Vprice-PriceScale*30 Then
Ventry = 2;
if Vposition == -1 and H >= Vprice+PriceScale*30 Then
Ventry = 2;
}
if Idx >= 1 and
Start == true and
Bcond == true Then{
if (Entrycnt == 0 and Ventry == 1 and Vposition == -1) or
(Entrycnt == 0 and Ventry == 2 and Vposition != 1) or
((Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False )))) Then{
buy("B2");
}
}
if Idx >= 1 and
Start == true and
Scond == true then{
if (Entrycnt == 0 and Ventry == 1 and Vposition == 1) or
(Entrycnt == 0 and Ventry == 2 and Vposition != -1) or
((Entrycnt >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False )))) Then{
sell("S2");
}
}
즐거운 하루되세요
> 조민철 님이 쓴 글입니다.
> 제목 : 시스템 시간설정 조정
> 항상 감사드립니다
1.국내선물
아래시스템에서 장종료시간을 15:00 로 하고 당일매수청산을 15:00으로 하면 전일발생신호봉에 상관없이 아침 첫신호는 정상적으로 발생합니다
그런데 장종료시간을 12:30 으로 설정하면 12:30이후에도 신호가 발생하고 당일 마지막신호에따라
다음날 첫신호가 반대신호만 나옵니다..
수정부탁드립니다
##################################################
##### 당일 09:00 장시작 / 당일 12:30 장종료 #####
##################################################
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = entrycnt+1;
Idx = 0;
}
Idx = idx+1;
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = var11==1 and c>var78 and c>Hma1 ;
Scond = var11==-1 and c<var78 and c<Lma1 ;
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);
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 )) Then
buy("B1");
if Idx >= 1 and
Start == true and
Scond == true and
(EntryCnt == 0 or MarketPosition == 1 or (EntryCnt > 0 and MarketPosition == 0 and Condition2 == False )) Then
sell("S1");
##########################
##### 매수/매도 청산 #####
##########################
if MarketPosition == 1 and c<Cma1 and c<var48 Then
exitlong("eB_선행");
if MarketPosition == -1 and c>Cma1 and c>var48 Then
ExitShort("eS_선행");
##손절_1_20틱 자동손절##
SetStopLoss(PriceScale*20,PointStop);
###############################
##### 매일 12:30 강제청산 #####
###############################
if stime == 123000 or (stime > 123000 and stime[1] < 123000) Then{
exitlong("당일매수청산");
ExitShort("당일매도청산");
}
2.해외선물
아래시스템식은 첫신호를 발생시키지 않는 시스템식입니다
제가 발생시키고자하는 신호는 B2,S2 인데 S11,B11 신호가 발생합니다
수정부탁드립니다
##################################################
##### 당일 08:00 장시작 / 익일 04:30 장종료 #####
##################################################
input : 시작시간(080000),끝시간(043000);
var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
Ventry = 0;
Vposition = 0;
Vprice = 0;
MessageLog("%.2f",entrycnt);
}
Idx = idx+1;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then{
Entrycnt = entrycnt+1;
MessageLog("%.2f",entrycnt);
}
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = /*c>var77 and c<var79 and */ c>Hma1 and c>var78 and var58==1 and cma1>var78 ;
Scond = /*c>var77 and c<var79 and */ c<Lma1 and c<var78 and var58==-1 and cma1<var78 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB100",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS100",1) == true or IsExitName("StopLoss",1) == true);
if Ventry == 0 and
Idx >= 1 and
Start == true and
Bcond == true Then{
Ventry = 1;
Vposition = 1;
VPrice = C;
}
if Ventry == 0 and
Idx >= 1 and
Start == true and
Scond == true Then{
Ventry = 1;
Vposition = -1;
Vprice = C;
}
if Ventry != 0 Then{
if Vposition == 1 and L <= Vprice-PriceScale*30 Then
Ventry = 2;
if Vposition == -1 and H >= Vprice+PriceScale*30 Then
Ventry = 2;
}
if Idx >= 1 and
Start == true and
Bcond == true Then{
if Entrycnt == 0 and Ventry == 1 and Vposition == -1 Then
buy("B11");
if Entrycnt == 0 and Ventry == 2 and Vposition != 1 Then
buy("B12");
if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False ))) Then{
buy("B2");
}
}
if Idx >= 1 and
Start == true and
Scond == true then{
if Entrycnt == 0 and Ventry == 1 and Vposition == 1 Then
sell("S11");
if Entrycnt == 0 and Ventry == 2 and Vposition != -1 Then
sell("S12");
if (Entrycnt >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False ))) Then{
sell("S2");
}
}
감사합니다
이전글