커뮤니티
부탁합니다
2017-06-21 19:53:51
155
글번호 110633
input : 시작시간(101500),종료시간(172500);
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
if Bdate != Bdate[1] then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then{
BXcond = false;
SXcond = false;
if (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then{
if MarketPosition <= 0 and
Bxcond == false and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then
ExitLong("bx");
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
Sxcond == false and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
}
위 수식을 선물(항생)에 적용하면 17시 25분 이후에도 수식이 적용하여 동작합니다
17시 25분(일괄청산) 후 매매중지하고자 합니다
수식을 수정하여 주시기 바랍니다 감사합니다
답변 1
예스스탁 예스스탁 답변
2017-06-22 09:51:12
안녕하세요
예스스탁입니다.
항셍의 경우 다른 해외선물과는 다르게 시간을 체크해야 합니다.
아래식 참고하시기 바랍니다.
input : 시작시간(101500),종료시간(172500);
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then{
BXcond = false;
SXcond = false;
if (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then{
if MarketPosition <= 0 and
Bxcond == false and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then
ExitLong("bx");
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
Sxcond == false and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 부탁합니다
> input : 시작시간(101500),종료시간(172500);
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
if Bdate != Bdate[1] then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then{
BXcond = false;
SXcond = false;
if (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then{
if MarketPosition <= 0 and
Bxcond == false and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then
ExitLong("bx");
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
Sxcond == false and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
}
위 수식을 선물(항생)에 적용하면 17시 25분 이후에도 수식이 적용하여 동작합니다
17시 25분(일괄청산) 후 매매중지하고자 합니다
수식을 수정하여 주시기 바랍니다 감사합니다