커뮤니티
감사합니다
2017-03-24 16:58:40
130
글번호 108145
질문의도에 정확한 답변 감사드리며 파일보냅니다,
#,이제 마지막수정으로 에서 per1(18) 매매조건에서 진입후 익절청산,본절청산 혹은
손절청산후에도 지정한 장종료시간(23;50)이 남아 있을경우, per1(18)매매와 동일조건으로
1회만 더 진입하는 수식추가 부탁드립니다.(결국 per1(18)조건식은 지정시간내에 1~2회진입
이 가능한셈이지요)
= 언제나 늘 고맙습니다 =
답변 1
예스스탁 예스스탁 답변
2017-03-24 13:37:30
안녕하세요
예스스탁입니다.
input : Per1(18),시작시간1(103000),종료시간1(235000);
input : Per2(9),시작시간2(70000),종료시간2(125000);
var : Tcond1(false),Tcond2(false),entry1(0),entry2(0);
Var : S1(0),S2(1),S3(1),S4(1),T1(0);
if (시작시간1 == 0 and sdate != sdate[1]) or
(시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1))) Then{
Tcond1 = true;
entry1 = 0;;
}
if (종료시간1 == 0 and sdate != sdate[1]) or
(종료시간1 > 0 and (stime == 종료시간1 or (stime > 종료시간1 and stime[1] < 종료시간1))) Then{
Tcond1 = false;
if MarketPosition == 1 and (IsEntryName("b11") or IsEntryName("b12")) Then
ExitLong("Dbx1");
if MarketPosition == -1 and (IsEntryName("s11") or IsEntryName("s12")) Then
ExitShort("Dsx1");
}
if (시작시간2 == 0 and sdate != sdate[1]) or
(시작시간2 > 0 and (stime == 시작시간2 or (stime > 시작시간2 and stime[1] < 시작시간2))) Then{
Tcond2 = true;
entry2 = 0;
}
if (종료시간2 == 0 and sdate != sdate[1]) or
(종료시간2 > 0 and (stime == 종료시간2 or (stime > 종료시간2 and stime[1] < 종료시간2))) Then{
Tcond2 = false;
if MarketPosition == 1 and (IsEntryName("b21") or IsEntryName("b22")) Then
ExitLong("Dbx2");
if MarketPosition == -1 and (IsEntryName("s21") or IsEntryName("s22")) Then
ExitShort("Dsx2");
}
if Tcond1 == true and CurrentContracts > CurrentContracts[1] and
(LatestEntryName(0) == "b11" or
LatestEntryName(0) == "b12" or
LatestEntryName(0) == "s11" or
LatestEntryName(0) == "s12") Then
entry1 = entry1+1;
if Tcond2 == true and CurrentContracts > CurrentContracts[1] and
(LatestEntryName(0) == "b21" or
LatestEntryName(0) == "b22" or
LatestEntryName(0) == "s21" or
LatestEntryName(0) == "s22") Then
entry2 = entry2+1;
S1 = (dayhigh(0)+daylow(0))/2;
S2 = (dayhigh(1)+daylow(1))/2;
S3 = dayhigh(1);
S4 = daylow(1);
var1 = dayclose(1)+abs(S3-S4)*(Per1/100);
var2 = dayclose(1)-abs(S3-S4)*(Per1/100);
var3 = dayclose(1)+abs(S3-S4)*(Per2/100);
var4 = dayclose(1)-abs(S3-S4)*(Per2/100);
if MarketPosition == 0 and Tcond1 == true and entry1 < 2 Then{
if NextBarOpen <= var2 Then
buy("b11",AtStop,var2,2);
Else
buy("b12",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s11",AtStop,var1,2);
Else
sell("s12",Atlimit,var1,2);
}
if MarketPosition == 0 and Tcond2 == true and entry2 < 1 Then{
if NextBarOpen <= var4 Then
buy("b21",AtStop,var4,1);
Else
buy("b22",Atlimit,var4,1);
if NextBarOpen >= var3 Then
sell("s21",AtStop,var3,1);
Else
sell("s22",Atlimit,var3,1);
}
if MarketPosition == 1 and (IsEntryName("b11") or IsEntryName("b12")) Then{
exitlong("bl1",AtStop,EntryPrice-PriceScale*20);
exitlong("bx1",atlimit,EntryPrice+PriceScale*20,"",1,1);
exitlong("bx2",atlimit,var1,"",1,1);
if CurrentContracts < MaxContracts Then
exitlong("bx3",AtStop,var2,"",1,1);
}
if MarketPosition == 1 and (IsEntryName("b21") or IsEntryName("b22")) Then{
exitlong("bl2",AtStop,EntryPrice-PriceScale*7);
exitlong("bx22",atlimit,var3);
}
if MarketPosition == -1 and (IsEntryName("s11") or IsEntryName("s12")) Then{
ExitShort("sl1",AtStop,EntryPrice+PriceScale*20);
ExitShort("sx1",atlimit,EntryPrice-PriceScale*20,"",1,1);
ExitShort("sx2",atlimit,var2,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("sx3",AtStop,var1,"",1,1);
}
if MarketPosition == -1 and (IsEntryName("s21") or IsEntryName("s22")) Then{
ExitShort("sl2",AtStop,EntryPrice+PriceScale*7);
ExitShort("sx22",atlimit,var4);
}
즐거운 하루되세요
> 골든키 님이 쓴 글입니다.
> 제목 : 감사합니다
> 질문의도에 정확한 답변 감사드리며 파일보냅니다,
#,이제 마지막수정으로 52543 에서 per1(18) 매매조건에서 진입후 익절청산,본절청산 혹은
손절청산후에도 지정한 장종료시간(23;50)이 남아 있을경우, per1(18)매매와 동일조건으로
1회만 더 진입하는 수식추가 부탁드립니다.(결국 per1(18)조건식은 지정시간내에 1~2회진입
이 가능한셈이지요)
= 언제나 늘 고맙습니다 =
이전글