커뮤니티
시스템 매매횟수 제한
2014-12-13 23:27:26
155
글번호 81315
항상 감사드립니다
1.아래 시스템식에서 매매횟수를 4회로 제한하고 싶습니다
2.매매횟수4회로 제한하고 누적이익이 40틱을 초과하면 매매중지
위 두가지 시스쳄식 수정을 부탁드립니다
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 = data2(c)>피봇2 and data2(c)>Hma21 and vv11==1 and data2(c)>선행2 ;
Scond = data2(c)<피봇2 and data2(c)<Lma21 and vv11==-1 and data2(c)<선행2 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB_선행1",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_선행1",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");
답변 1
예스스탁 예스스탁 답변
2014-12-15 16:42:33
안녕하세요
예스스탁입니다.
input : 시작시간(090000),끝시간(123000);
var : Start(false),entrycnt(0),Bcond(false),Bcond1(false),Scond(false),Scond1(false),idx(0);
var : NP(0),PreNP(0),dayPL(0);
NP = NetProfit;
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Start = True;
entrycnt = 0;
Idx = 0;
PreNP = NP;
}
dayPL = (NP-PreNP)+PositionProfit;
Idx = idx+1;
if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then
Start = false;
Bcond = data2(c)>피봇2 and data2(c)>Hma21 and vv11==1 and data2(c)>선행2 ;
Scond = data2(c)<피봇2 and data2(c)<Lma21 and vv11==-1 and data2(c)<선행2 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB_선행1",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_선행1",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 {
if dayPL <= PriceScale*40 and EntryCnt < 4 THEN
buy("B1");
Else
ExitShort();
}
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{
IF dayPL <= PriceScale*40 and EntryCnt < 4 Then
sell("S1");
Else
ExitLong();
}
즐거운 하루되세요
> 조민철 님이 쓴 글입니다.
> 제목 : 시스템 매매횟수 제한
> 항상 감사드립니다
1.아래 시스템식에서 매매횟수를 4회로 제한하고 싶습니다
2.매매횟수4회로 제한하고 누적이익이 40틱을 초과하면 매매중지
위 두가지 시스쳄식 수정을 부탁드립니다
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 = data2(c)>피봇2 and data2(c)>Hma21 and vv11==1 and data2(c)>선행2 ;
Scond = data2(c)<피봇2 and data2(c)<Lma21 and vv11==-1 and data2(c)<선행2 ;
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("eB_선행1",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("eS_선행1",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");
다음글
이전글