커뮤니티

질문 있습니다.

프로필 이미지
jacobs
2013-10-10 10:57:28
156
글번호 68276
답변완료
안녕하세요. 수고하십니다! 며칠 전 수식에 대해 물어보고 답을 받았습니다. 정말 감사드리고요. 그런데 이 수식으로 백테스트를 해보니 아예 매매가 안되더라구요. 뭐가 문제인가 이것저것 지워보고 돌려봐도 답을 모르겠습니다. 죄송하지만 왜 진입 자체가 안되는지 확인 부탁드립니다. 수식: &#65279;1) 매수 진입 a) 9개 봉의 단기 이평선이 18개 봉의 장기 이평선을 상향 교차 시 이전 12개 봉의 최고가를 찾고 여기에 1.03을 곱한다. 이 값이 매수진입가격 b) 이동평균선 상향 교차가 나타나면 진입가에 buy stop 주문. 이 주문은 교차 이후 12개의 봉이 완성될때까지 유효 c) 만약 매수포지션을 가지고 있다가 매수 청산 규칙에 의해서 청산을 하였다면, 최근 10개 봉의 최고가에 buy stop주문을 걸고 청산 이후 15개 봉까지 이 주문이 유효하도록 한다.&#65279; &#65279; 2) 매도 진입 a) &#65279; &#65279;9개 봉의 단기 이평선이 18개 봉의 장기 이평선을 하향 교차 시 이전 12개 봉의 최저가를 찾고 여기에 0.97을 곱한다. 이 값이 매도진입가격 b) 이동평균선 하향 교차가 나타나면 진입가에 sell stop 주문. 이 주문은 교차 이후 12개의 봉이 완성될때까지 유효 c) 만약 매도포지션을 가지고 있다가 매도 청산 규칙에 의해서 청산을 하였다면, 최근 10개 봉의 최저가에 sell stop주문을 걸고 청산 이후 15개 봉까지 이 주문이 유효하도록 한다.&#65279; 3) 청산 a) 이전 8개 봉의 최저가에 도달하면 매수 포지션 청산 b) 이전 8개 봉의 최고가에 도달하면 매도 포지션 청산 Input : shortperiod(9), longperiod(18), chlen(12), trailbar(8), rebars(15) ; vars: shortma(0), longma(0), lentryprice(0), sentryprice(0), lcnt(0), scnt(0), reentrycount(0), lstopprice(0), sstopprice(0), lreentryprice(0),sreentryprice(0); shortma = ma(c, shortperiod); longma = ma(c, longperiod); ##매수주문 if crossup(shortma, longma) and BarIndex > 1 then { lentryprice=highest(h, chlen)*1.03; lcnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < lcnt+chlen Then buy("b",atstop,lentryprice,0); ##매도주문 if crossdown(shortma, longma) and BarIndex > 1 then { sentryprice=lowest(l, chlen)[1]*0.97; scnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < scnt+chlen Then sell("s",atstop,sentryprice,0); ##trailing stop if marketposition == 1 then { lstopprice=lowest(l,trailbar); exitlong("longstop",atlimit,lstopprice); } if marketposition == -1 then { sstopprice=highest(h,trailbar); exitshort("shortstop",atlimit,sstopprice); } ##reentry if marketposition == 0 and marketposition(1) == 1 and BarsSinceExit(1) < rebars then { lreentryprice=highest(h,10); buy("long reentry",atstop,lreentryprice); } if marketposition == 0 and marketposition(1) == -1 and BarsSinceExit(1) < rebars then { sreentryprice=lowest(l,10); sell("short reentry",atstop,sreentryprice); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-10-10 18:06:39

안녕하세요 예스스탁입니다. 진입함수의 수량을 지정하는 부분에 0이 셋팅이 되어 잇었습니다. 진입주문함수의 4번재 파라메터는 수량이라 0이면 신호가 발생하지 않습니다. 수정한 식입니다. Input : shortperiod(9), longperiod(18), chlen(12), trailbar(8), rebars(15) ; vars: shortma(0), longma(0), lentryprice(0), sentryprice(0), lcnt(0), scnt(0), reentrycount(0), lstopprice(0), sstopprice(0), lreentryprice(0),sreentryprice(0); shortma = ma(c, shortperiod); longma = ma(c, longperiod); ##매수주문 if crossup(shortma, longma) and BarIndex > 1 then { lentryprice=highest(h, chlen)*1.03; lcnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < lcnt+chlen Then buy("b",atstop,lentryprice); ##매도주문 if crossdown(shortma, longma) and BarIndex > 1 then { sentryprice=lowest(l, chlen)[1]*0.97; scnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < scnt+chlen Then sell("s",atstop,sentryprice); ##trailing stop if marketposition == 1 then { lstopprice=lowest(l,trailbar); exitlong("longstop",atlimit,lstopprice); } if marketposition == -1 then { sstopprice=highest(h,trailbar); exitshort("shortstop",atlimit,sstopprice); } ##reentry if marketposition == 0 and marketposition(1) == 1 and BarsSinceExit(1) < rebars then { lreentryprice=highest(h,10); buy("long reentry",atstop,lreentryprice); } if marketposition == 0 and marketposition(1) == -1 and BarsSinceExit(1) < rebars then { sreentryprice=lowest(l,10); sell("short reentry",atstop,sreentryprice); } 즐거운 하루되세요 > jacobs 님이 쓴 글입니다. > 제목 : 질문 있습니다. > 안녕하세요. 수고하십니다! 며칠 전 수식에 대해 물어보고 답을 받았습니다. 정말 감사드리고요. 그런데 이 수식으로 백테스트를 해보니 아예 매매가 안되더라구요. 뭐가 문제인가 이것저것 지워보고 돌려봐도 답을 모르겠습니다. 죄송하지만 왜 진입 자체가 안되는지 확인 부탁드립니다. 수식: &#65279;1) 매수 진입 a) 9개 봉의 단기 이평선이 18개 봉의 장기 이평선을 상향 교차 시 이전 12개 봉의 최고가를 찾고 여기에 1.03을 곱한다. 이 값이 매수진입가격 b) 이동평균선 상향 교차가 나타나면 진입가에 buy stop 주문. 이 주문은 교차 이후 12개의 봉이 완성될때까지 유효 c) 만약 매수포지션을 가지고 있다가 매수 청산 규칙에 의해서 청산을 하였다면, 최근 10개 봉의 최고가에 buy stop주문을 걸고 청산 이후 15개 봉까지 이 주문이 유효하도록 한다.&#65279; &#65279; 2) 매도 진입 a) &#65279; &#65279;9개 봉의 단기 이평선이 18개 봉의 장기 이평선을 하향 교차 시 이전 12개 봉의 최저가를 찾고 여기에 0.97을 곱한다. 이 값이 매도진입가격 b) 이동평균선 하향 교차가 나타나면 진입가에 sell stop 주문. 이 주문은 교차 이후 12개의 봉이 완성될때까지 유효 c) 만약 매도포지션을 가지고 있다가 매도 청산 규칙에 의해서 청산을 하였다면, 최근 10개 봉의 최저가에 sell stop주문을 걸고 청산 이후 15개 봉까지 이 주문이 유효하도록 한다.&#65279; 3) 청산 a) 이전 8개 봉의 최저가에 도달하면 매수 포지션 청산 b) 이전 8개 봉의 최고가에 도달하면 매도 포지션 청산 Input : shortperiod(9), longperiod(18), chlen(12), trailbar(8), rebars(15) ; vars: shortma(0), longma(0), lentryprice(0), sentryprice(0), lcnt(0), scnt(0), reentrycount(0), lstopprice(0), sstopprice(0), lreentryprice(0),sreentryprice(0); shortma = ma(c, shortperiod); longma = ma(c, longperiod); ##매수주문 if crossup(shortma, longma) and BarIndex > 1 then { lentryprice=highest(h, chlen)*1.03; lcnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < lcnt+chlen Then buy("b",atstop,lentryprice,0); ##매도주문 if crossdown(shortma, longma) and BarIndex > 1 then { sentryprice=lowest(l, chlen)[1]*0.97; scnt=BarIndex; } if marketposition <> 1 and BarIndex > 0 and BarIndex < scnt+chlen Then sell("s",atstop,sentryprice,0); ##trailing stop if marketposition == 1 then { lstopprice=lowest(l,trailbar); exitlong("longstop",atlimit,lstopprice); } if marketposition == -1 then { sstopprice=highest(h,trailbar); exitshort("shortstop",atlimit,sstopprice); } ##reentry if marketposition == 0 and marketposition(1) == 1 and BarsSinceExit(1) < rebars then { lreentryprice=highest(h,10); buy("long reentry",atstop,lreentryprice); } if marketposition == 0 and marketposition(1) == -1 and BarsSinceExit(1) < rebars then { sreentryprice=lowest(l,10); sell("short reentry",atstop,sreentryprice); }