커뮤니티

수식 수정문의

프로필 이미지
무명
2011-10-25 13:51:02
508
글번호 44088
답변완료
아래 수정해 주신 마틴게일 전략은 피라미딩을 체크해도 적용이 안되는데...피라미딩이 가능하게 수정부탁드립니다. 그리고 데이트레이딩이므로 다음날 부터는 1계약부터 시작하게 부탁드립니다. 수고하세요... input: P1(5), P2(20),maxcont(10); vars: mafast(0), maslow(0), ncontr(0),XCommission(0),XSlippage(0); mafast = average(close, P1); maslow = average(close, P2); XCommission = c*(ExitCommission/100); #%설정 XSlippage = ExitSlippage; #Pt설정 if crossup(mafast,maslow) then { if MarketPosition == -1 then { exitshort(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != 1 then { Buy("B", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),10)); } } if CrossDown(mafast,maslow) then { if MarketPosition == 1 then { exitlong(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != -1 then { Sell("S", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),10)); } } 즐거운 하루되세요
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-10-26 10:13:28

안녕하세요 예스스탁이비다. 해당식은 이동평균 골든-데드식이므로 피라미딩이 가능한 내용이 없습니다. 첫진입부터 수량을 다시 1로 카운트하는 내용만 추가해서 올려드립니다. input: P1(5), P2(20),maxcont(10); vars: mafast(0), maslow(0), ncontr(0),XCommission(0),XSlippage(0),count(0),cnt(0); if date != date[1] Then ncontr = 1; mafast = average(close, P1); maslow = average(close, P2); XCommission = c*(ExitCommission/100); #%설정 XSlippage = ExitSlippage; #Pt설정 count = 0; for cnt = 0 to 10{ if EntryDate(cnt) == sdate Then count = count+1; } if count < 1 Then{ if crossup(mafast,maslow) then buy("b1",OnClose,def, ncontr); if CrossDown(mafast,maslow) then Sell("s1",OnClose,def, ncontr); } if count >= 1 Then{ if crossup(mafast,maslow) then { if MarketPosition == -1 then { exitshort(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != 1 then { Buy("B", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),maxcont)); } } if CrossDown(mafast,maslow) then { if MarketPosition == 1 then { exitlong(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != -1 then { Sell("S", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),maxcont)); } } } SetStopEndofday(150000); 즐거운 하루되세요 > 무명 님이 쓴 글입니다. > 제목 : 수식 수정문의 > 아래 수정해 주신 마틴게일 전략은 피라미딩을 체크해도 적용이 안되는데...피라미딩이 가능하게 수정부탁드립니다. 그리고 데이트레이딩이므로 다음날 부터는 1계약부터 시작하게 부탁드립니다. 수고하세요... input: P1(5), P2(20),maxcont(10); vars: mafast(0), maslow(0), ncontr(0),XCommission(0),XSlippage(0); mafast = average(close, P1); maslow = average(close, P2); XCommission = c*(ExitCommission/100); #%설정 XSlippage = ExitSlippage; #Pt설정 if crossup(mafast,maslow) then { if MarketPosition == -1 then { exitshort(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != 1 then { Buy("B", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),10)); } } if CrossDown(mafast,maslow) then { if MarketPosition == 1 then { exitlong(); if (PositionProfit-(XCommission+XSlippage)*CurrentContracts) < 0 then ncontr = ncontr+1; else ncontr = 1; } if MarketPosition != -1 then { Sell("S", onclose,def,iff(max(1,ncontr)<10,max(1,ncontr),10)); } } 즐거운 하루되세요