커뮤니티

부탁드립니다

프로필 이미지
남산
2017-06-30 15:24:30
112
글번호 110887
답변완료
input : 시작시간(090000),종료시간(152000); input : Period15(200),Period16(100),Period17(40),Period18(20),익절틱수(20),손절틱수(15); Input : Period(500),sigPeriod(150); input : Period33(100),sigPeriod34(75); input : Period43(20),sigPeriod44(15); var : mav15(0),mav16(0),mav17(0),mav18(0),Bxcond(false),Sxcond(false); var : Tcond(false); mav15 = ma(c, Period15); mav16 = ma(c, Period16); mav17 = ma(c, Period17); mav18 = ma(c, Period18); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); value3 = TRIX(Period33); value4 = ema(value3, sigPeriod34); value5 = TRIX(Period43); value6 = ema(value5, sigPeriod44); 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) Then BXcond = true; if (IsExitName("sl",1) == true or IsExitName("sp",1) == true) Then SXcond = true; } if Tcond == true then{ if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 > value4 and mav15[3] < mav15[2] and mav15[2] < mav15[1] and mav15[1] < mav15 and mav16[1] < mav16 and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b1",OnClose,def,1); if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 < value4 and value5 > value6 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b2",OnClose,def,1); if MarketPosition == 1 Then{ if (mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 3) 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 < 5) Then buy("bb2",OnClose,def,1); if IsEntryName("b1") == true and (CrossDown(value1, value2)) or (CrossDown(value3, value4)) or (mav17[3] > mav17[2] and mav17[2] > mav17[1] and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then ExitLong("bx1"); if IsEntryName("b2") == true and CrossDown(value5, value6) Then ExitLong("bx2"); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 < value4 and mav15[3] > mav15[2] and mav15[2] > mav15[1] and mav15[1] > mav15 and mav16[1] > mav16 and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s1",OnClose,def,1); if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 > value4 and value5 < value6 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s2",OnClose,def,1); if MarketPosition == -1 then{ if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 3 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 < 5 Then sell("ss2",OnClose,def,1); if IsExitName("s1") == true and (crossup(value1, value2)) or (crossup(value3, value4)) or (mav17[3] < mav17[2] and mav17[2] < mav17[1] and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then ExitShort("sx1"); if IsExitName("s2") == true and crossup(value5, value6) Then ExitShort("sx2"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } } 위 수식에서 한가지 이상한 점이 있어 문의합니다 다른 수식은 정상으로 동작하지만 s2-ss1-ss2 ====== sx2 (모두청산)이 정상적으로 동작하지 않고 있습니다 b1-bb1-bb2 ====== bx1 모두청산정상 b2-bb1-bb2 ====== bx2 모두청산정상 s1-ss1-ss2 ====== sx1 모두청산정상 s2-ss1-ss2 ====== sx2 동작불가 sx1으로 동작 어떤 이유인지 모르겠습니다 계속 수정도 했지만 원인을 모르겠습니다 수정해 주시면 대단히 고맙겠습니다 매번 감사합니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-06-30 16:28:39

안녕하세요 예스스탁입니다. 진입명 지정함수가 잘못지정되어 있었습니다. 수정한 식입니다. input : 시작시간(090000),종료시간(152000); input : Period15(200),Period16(100),Period17(40),Period18(20),익절틱수(20),손절틱수(15); Input : Period(500),sigPeriod(150); input : Period33(100),sigPeriod34(75); input : Period43(20),sigPeriod44(15); var : mav15(0),mav16(0),mav17(0),mav18(0),Bxcond(false),Sxcond(false); var : Tcond(false); mav15 = ma(c, Period15); mav16 = ma(c, Period16); mav17 = ma(c, Period17); mav18 = ma(c, Period18); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); value3 = TRIX(Period33); value4 = ema(value3, sigPeriod34); value5 = TRIX(Period43); value6 = ema(value5, sigPeriod44); 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) Then BXcond = true; if (IsExitName("sl",1) == true or IsExitName("sp",1) == true) Then SXcond = true; } if Tcond == true then{ if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 > value4 and mav15[3] < mav15[2] and mav15[2] < mav15[1] and mav15[1] < mav15 and mav16[1] < mav16 and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b1",OnClose,def,1); if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 < value4 and value5 > value6 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b2",OnClose,def,1); if MarketPosition == 1 Then{ if (mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 3) 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 < 5) Then buy("bb2",OnClose,def,1); if IsEntryName("b1") == true and (CrossDown(value1, value2)) or (CrossDown(value3, value4)) or (mav17[3] > mav17[2] and mav17[2] > mav17[1] and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then ExitLong("bx1"); if IsEntryName("b2") == true and CrossDown(value5, value6) Then ExitLong("bx2"); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 < value4 and mav15[3] > mav15[2] and mav15[2] > mav15[1] and mav15[1] > mav15 and mav16[1] > mav16 and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s1",OnClose,def,1); if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 > value4 and value5 < value6 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s2",OnClose,def,1); if MarketPosition == -1 then{ if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 3 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 < 5 Then sell("ss2",OnClose,def,1); if IsEntryName("s1") == true and (crossup(value1, value2)) or (crossup(value3, value4)) or (mav17[3] < mav17[2] and mav17[2] < mav17[1] and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then ExitShort("sx1"); if IsEntryName("s2") == true and crossup(value5, value6) Then ExitShort("sx2"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } } 즐거운 하루되세요 > 남산 님이 쓴 글입니다. > 제목 : 부탁드립니다 > input : 시작시간(090000),종료시간(152000); input : Period15(200),Period16(100),Period17(40),Period18(20),익절틱수(20),손절틱수(15); Input : Period(500),sigPeriod(150); input : Period33(100),sigPeriod34(75); input : Period43(20),sigPeriod44(15); var : mav15(0),mav16(0),mav17(0),mav18(0),Bxcond(false),Sxcond(false); var : Tcond(false); mav15 = ma(c, Period15); mav16 = ma(c, Period16); mav17 = ma(c, Period17); mav18 = ma(c, Period18); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); value3 = TRIX(Period33); value4 = ema(value3, sigPeriod34); value5 = TRIX(Period43); value6 = ema(value5, sigPeriod44); 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) Then BXcond = true; if (IsExitName("sl",1) == true or IsExitName("sp",1) == true) Then SXcond = true; } if Tcond == true then{ if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 > value4 and mav15[3] < mav15[2] and mav15[2] < mav15[1] and mav15[1] < mav15 and mav16[1] < mav16 and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b1",OnClose,def,1); if MarketPosition <= 0 and Bxcond == false and (value1 > value2 and value3 < value4 and value5 > value6 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then buy("b2",OnClose,def,1); if MarketPosition == 1 Then{ if (mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 3) 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 < 5) Then buy("bb2",OnClose,def,1); if IsEntryName("b1") == true and (CrossDown(value1, value2)) or (CrossDown(value3, value4)) or (mav17[3] > mav17[2] and mav17[2] > mav17[1] and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then ExitLong("bx1"); if IsEntryName("b2") == true and CrossDown(value5, value6) Then ExitLong("bx2"); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 < value4 and mav15[3] > mav15[2] and mav15[2] > mav15[1] and mav15[1] > mav15 and mav16[1] > mav16 and mav17[1] > mav17 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s1",OnClose,def,1); if MarketPosition >= 0 and Sxcond == false and (value1 < value2 and value3 > value4 and value5 < value6 and mav18[3] > mav18[2] and mav18[2] > mav18[1] and mav18[1] > mav18) Then sell("s2",OnClose,def,1); if MarketPosition == -1 then{ if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 3 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 < 5 Then sell("ss2",OnClose,def,1); if IsExitName("s1") == true and (crossup(value1, value2)) or (crossup(value3, value4)) or (mav17[3] < mav17[2] and mav17[2] < mav17[1] and mav17[1] < mav17 and mav18[3] < mav18[2] and mav18[2] < mav18[1] and mav18[1] < mav18) Then ExitShort("sx1"); if IsExitName("s2") == true and crossup(value5, value6) Then ExitShort("sx2"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } } 위 수식에서 한가지 이상한 점이 있어 문의합니다 다른 수식은 정상으로 동작하지만 s2-ss1-ss2 ====== sx2 (모두청산)이 정상적으로 동작하지 않고 있습니다 b1-bb1-bb2 ====== bx1 모두청산정상 b2-bb1-bb2 ====== bx2 모두청산정상 s1-ss1-ss2 ====== sx1 모두청산정상 s2-ss1-ss2 ====== sx2 동작불가 sx1으로 동작 어떤 이유인지 모르겠습니다 계속 수정도 했지만 원인을 모르겠습니다 수정해 주시면 대단히 고맙겠습니다 매번 감사합니다