커뮤니티

문의합니다

프로필 이미지
남산
2018-01-28 17:01:53
206
글번호 116097
답변완료
아래 수식은 피라미딩 모든진입 신호허용을 첵크하면 정산적으로 동작합니다 그러나 피라미딩 허용안함으로 첵크하면 추가진입(수1, 도1)이 가끔 발생합니다 아래 수식에서 피라미딩 허용안함을 첵크하면 추가진입이 나오지 않게 수정하여 주시면 고맙겠습니다 감사합니다 input : 시작시간(090000),종료시간(152000); input : Period30(9),Period20(19),Period100(100),Period180(180),Period(12),sigPeriod(9),Period1(1),Period120(120),익절틱수(10),손절틱수(10); var : mav30(0),mav20(0),mav100(0),mav180(0),mav1(0),mav120(0),Bxcond(false),Sxcond(false); var : Tcond(false); var : T(0); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); mav30 = ma(c, Period30); mav20 = ma(c, Period20); mav100 = ma(c, Period100); mav180 = ma(c, Period180); mav1 = ma(c, Period1); mav120 = ma(c, Period120); 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("bl1",1) == true or IsExitName("bp1",1) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then BXcond = true; if (IsExitName("sl1",1) == true or IsExitName("sp1",1) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then SXcond = true; } if Tcond == true then{ if MarketPosition <= 0 and Bxcond == false and crossup(mav30, mav20) and mav180 <= mav100 and value1 > value2 Then{ buy("매수",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav30[2] < mav30[1] and mav30[1] < mav30 and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and value1 > value2 Then{ buy("매수2",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and mav30 > mav20 and value1 > value2 Then{ buy("매수3",OnClose,def,1); } if MarketPosition == 1 Then{ if mav1[2] > mav1[1] and mav1[1] < mav1 and value1 > value2 and CurrentContracts < 2 Then buy("수1",OnClose,def,1); if IsEntryName("매수") == true and CrossDown(mav30, mav20) Then ExitLong("수청산"); if IsEntryName("매수2") == true and CrossDown(mav30, mav20) or CrossDown(value1, value2) Then ExitLong("수청산2"); if IsEntryName("매수3") == true and CrossDown(mav30, mav20) or CrossDown(value1, value2) Then ExitLong("수청산3"); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and CrossDown(mav30, mav20) and mav180 >= mav100 and value1 < value2 Then{ sell("매도",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav30[2] > mav30[1] and mav30[1] > mav30 and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and value1 < value2 Then{ sell("매도2",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and mav30 < mav20 and value1 < value2 Then{ sell("매도3",OnClose,def,1); } if MarketPosition == -1 then{ if mav1[2] < mav1[1] and mav1[1] > mav1 and value1 < value2 and CurrentContracts < 2 Then sell("도1",OnClose,def,1); if IsEntryName("매도") == true and crossup(mav30, mav20) Then ExitShort("도청산"); if IsEntryName("매도2") == true and crossup(mav30, mav20) or crossup(value1, value2) Then ExitShort("도청산2"); if IsEntryName("매도3") == true and crossup(mav30, mav20) or crossup(value1, value2) Then ExitShort("도청산3"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-01-29 11:44:55

안녕하세요 예스스탁입니다. 식을 수정했습니다. input : 시작시간(090000),종료시간(152000); input : Period30(9),Period20(19),Period100(100),Period180(180),Period(12),sigPeriod(9),Period1(1),Period120(120),익절틱수(10),손절틱수(10); var : mav30(0),mav20(0),mav100(0),mav180(0),mav1(0),mav120(0),Bxcond(false),Sxcond(false); var : Tcond(false); var : T(0); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); mav30 = ma(c, Period30); mav20 = ma(c, Period20); mav100 = ma(c, Period100); mav180 = ma(c, Period180); mav1 = ma(c, Period1); mav120 = ma(c, Period120); 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("bl1",1) == true or IsExitName("bp1",1) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then BXcond = true; if (IsExitName("sl1",1) == true or IsExitName("sp1",1) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then SXcond = true; } if Tcond == true then { if MarketPosition <= 0 and Bxcond == false and crossup(mav30, mav20) and mav180 <= mav100 and value1 > value2 Then{ buy("매수",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav30[2] < mav30[1] and mav30[1] < mav30 and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and value1 > value2 Then{ buy("매수2",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and mav30 > mav20 and value1 > value2 Then{ buy("매수3",OnClose,def,1); } if MarketPosition == 1 Then{ Condition1 = false; if IsEntryName("매수") == true and CrossDown(mav30, mav20) Then{ Condition1 = true; ExitLong("수청산"); } if IsEntryName("매수2") == true and (CrossDown(mav30, mav20) or CrossDown(value1, value2)) Then{ Condition1 = true; ExitLong("수청산2"); } if IsEntryName("매수3") == true and (CrossDown(mav30, mav20) or CrossDown(value1, value2)) Then{ Condition1 = true; ExitLong("수청산3"); } if Condition1 == false and mav1[2] > mav1[1] and mav1[1] < mav1 and value1 > value2 and CurrentContracts < 2 Then buy("수1",OnClose,def,1); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and CrossDown(mav30, mav20) and mav180 >= mav100 and value1 < value2 Then{ sell("매도",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav30[2] > mav30[1] and mav30[1] > mav30 and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and value1 < value2 Then{ sell("매도2",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and mav30 < mav20 and value1 < value2 Then{ sell("매도3",OnClose,def,1); } if MarketPosition == -1 then{ Condition2 == false; if IsEntryName("매도") == true and crossup(mav30, mav20) Then{ Condition2 = true; ExitShort("도청산"); } if IsEntryName("매도2") == true and crossup(mav30, mav20) or crossup(value1, value2) Then{ Condition2 = true; ExitShort("도청산2"); } if IsEntryName("매도3") == true and crossup(mav30, mav20) or crossup(value1, value2) Then{ Condition2 = true; ExitShort("도청산3"); } if Condition2 == false and mav1[2] < mav1[1] and mav1[1] > mav1 and value1 < value2 and CurrentContracts < 2 Then sell("도1",OnClose,def,1); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } } 즐거운 하루되세요 > 남산 님이 쓴 글입니다. > 제목 : 문의합니다 > 아래 수식은 피라미딩 모든진입 신호허용을 첵크하면 정산적으로 동작합니다 그러나 피라미딩 허용안함으로 첵크하면 추가진입(수1, 도1)이 가끔 발생합니다 아래 수식에서 피라미딩 허용안함을 첵크하면 추가진입이 나오지 않게 수정하여 주시면 고맙겠습니다 감사합니다 input : 시작시간(090000),종료시간(152000); input : Period30(9),Period20(19),Period100(100),Period180(180),Period(12),sigPeriod(9),Period1(1),Period120(120),익절틱수(10),손절틱수(10); var : mav30(0),mav20(0),mav100(0),mav180(0),mav1(0),mav120(0),Bxcond(false),Sxcond(false); var : Tcond(false); var : T(0); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); mav30 = ma(c, Period30); mav20 = ma(c, Period20); mav100 = ma(c, Period100); mav180 = ma(c, Period180); mav1 = ma(c, Period1); mav120 = ma(c, Period120); 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("bl1",1) == true or IsExitName("bp1",1) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then BXcond = true; if (IsExitName("sl1",1) == true or IsExitName("sp1",1) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then SXcond = true; } if Tcond == true then{ if MarketPosition <= 0 and Bxcond == false and crossup(mav30, mav20) and mav180 <= mav100 and value1 > value2 Then{ buy("매수",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav30[2] < mav30[1] and mav30[1] < mav30 and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and value1 > value2 Then{ buy("매수2",OnClose,def,1); } if MarketPosition <= 0 and Bxcond == false and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] <= mav120[2] and mav120[2] <= mav120[1] and mav120[1] < mav120 and mav30 > mav20 and value1 > value2 Then{ buy("매수3",OnClose,def,1); } if MarketPosition == 1 Then{ if mav1[2] > mav1[1] and mav1[1] < mav1 and value1 > value2 and CurrentContracts < 2 Then buy("수1",OnClose,def,1); if IsEntryName("매수") == true and CrossDown(mav30, mav20) Then ExitLong("수청산"); if IsEntryName("매수2") == true and CrossDown(mav30, mav20) or CrossDown(value1, value2) Then ExitLong("수청산2"); if IsEntryName("매수3") == true and CrossDown(mav30, mav20) or CrossDown(value1, value2) Then ExitLong("수청산3"); ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and CrossDown(mav30, mav20) and mav180 >= mav100 and value1 < value2 Then{ sell("매도",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav30[2] > mav30[1] and mav30[1] > mav30 and mav100[3] >= mav100[2] and mav100[2] >= mav100[1] and mav100[1] > mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and value1 < value2 Then{ sell("매도2",OnClose,def,1); } if MarketPosition >= 0 and Sxcond == false and mav100[3] <= mav100[2] and mav100[2] <= mav100[1] and mav100[1] < mav100 and mav120[3] >= mav120[2] and mav120[2] >= mav120[1] and mav120[1] > mav120 and mav30 < mav20 and value1 < value2 Then{ sell("매도3",OnClose,def,1); } if MarketPosition == -1 then{ if mav1[2] < mav1[1] and mav1[1] > mav1 and value1 < value2 and CurrentContracts < 2 Then sell("도1",OnClose,def,1); if IsEntryName("매도") == true and crossup(mav30, mav20) Then ExitShort("도청산"); if IsEntryName("매도2") == true and crossup(mav30, mav20) or crossup(value1, value2) Then ExitShort("도청산2"); if IsEntryName("매도3") == true and crossup(mav30, mav20) or crossup(value1, value2) Then ExitShort("도청산3"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } }