커뮤니티

문의드립니다.

프로필 이미지
깜피
2021-04-30 09:11:45
1352
글번호 148554
답변완료
안녕하세요, 수식 작성에 도움을 주셔서 감사드립니다. 분할 매도 수식 문의드립니다. 일봉시스템이고 가격조건만족시 즉시 신호가 발생하게 해서 거래중입니다. 1. 시스템 성능을 개량하고자 분할매도를 백테스팅하려고 하는데, 가격이 B1으로 진입했을 때 매도가격에서 40%, 매도가격*1.05%에서 30%, 매도가격*1.1에서 나머지를 매도하려고 하고, 매도가격*1.1까지 가지 못하고 하락하는 경우 매도가격*1.05에서 전량 익절하려고 합니다. (당일청산) 단 매도가격이 상한가 근처여서 매도가격*1.05가 상한가를 넘어서는 경우는 익일에 수식을 적용하고 싶습니다. 수식 검토 부탁드립니다. 즐거운 주말 보내세요. if LatestEntryName(0) == "b1" Then { ExitLong("bx1",AtLimit,매도가격,"",MaxContracts*0.4,2); ExitLong("bx1-1%",AtLimit,매도가격*(1.05),"",MaxContracts*0.3,2); if H > 매도가격 * 1.05 and H<매도가격 * 1.1 then { ExitLong("bx1-1-1",AtStop,매도가격*1.05); } ExitLong("bx1-2",AtLimit,매도가격*(1.1)); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-04-30 11:47:27

안녕하세요 예스스탁입니다. var : BH(0); var : 상한가(0), UpLimit(0); var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0); if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then UpLimit = (BP[0] * 1.12); Else if date >= 20050328 and date < 20150615 Then UpLimit = (BP[0] * 1.15); Else UpLimit = (BP[0] * 1.30); if CodeCategory() == 2 then { if date >= 20030721 then { up1 = int(UpLimit/100+0.00001)*100; up2 = int(UpLimit/100+0.00001)*100; up3 = int(UpLimit/100+0.00001)*100; up4 = int(UpLimit/50+0.00001)*50; up5 = int(UpLimit/10+0.00001)*10; up6 = int(UpLimit/5+0.00001)*5; up7 = int(UpLimit/1+0.00001)*1; } else { up1 = int(UpLimit/1000+0.00001)*1000; up2 = int(UpLimit/500+0.00001)*500; up3 = int(UpLimit/100+0.00001)*100; up4 = int(UpLimit/50+0.00001)*50; up5 = int(UpLimit/10+0.00001)*10; up6 = int(UpLimit/10+0.00001)*10; up7 = int(UpLimit/1+0.00001)*1; } } Else { up1 = int(UpLimit/1000+0.00001)*1000; up2 = int(UpLimit/500+0.00001)*500; up3 = int(UpLimit/100+0.00001)*100; up4 = int(UpLimit/50+0.00001)*50; up5 = int(UpLimit/10+0.00001)*10; up6 = int(UpLimit/5+0.00001)*5; up7 = int(UpLimit/1+0.00001)*1; } if CodeCategory() == 1 || CodeCategory() == 2 then { if sdate < 20101004 Then { If BP >= 500000 Then 상한가 = up1; Else If BP >= 100000 Then 상한가 = iff(up2>=500000, up1, up2); Else If BP >= 50000 Then 상한가 = iff(up3>=100000, up2, up3); Else If BP >= 10000 Then 상한가 = iff(up4>=50000, up3, up4); Else If BP >= 5000 Then 상한가 = iff(up5>=10000, up4, up5); Else If BP >= 1000 Then 상한가 = iff(up5>=5000, up5, up6); Else 상한가 = iff(up6>=1000, up6, up6); } Else { If BP >= 500000 Then 상한가 = up1; Else If BP >= 100000 Then 상한가 = iff(up2>=500000, up1, up2); Else If BP >= 50000 Then 상한가 = iff(up3>=100000, up2, up3); Else If BP >= 10000 Then 상한가 = iff(up4>=50000, up3, up4); Else If BP >= 5000 Then 상한가 = iff(up5>=10000, up4, up5); Else If BP >= 1000 Then 상한가 = iff(up5>=5000, up5, up6); Else 상한가 = iff(up6>=1000, up6, up7); } } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = up6; } } if LatestEntryName(0) == "b1" Then { if CurrentContracts > CurrentContracts[1] Then BH = H; if H > BH Then BH = H; if BH < 매도가격 and 매도가격 < 상한가 Then ExitLong("bx1",AtLimit,매도가격,"",Floor(MaxContracts*0.4),1); if BH < 매도가격*1.05 and 매도가격*1.05 < 상한가 Then ExitLong("bx1-1%",AtLimit,매도가격*1.05,"",Floor(MaxContracts*0.3),1); if BH < 매도가격*1.1 and 매도가격*1.10 < 상한가 Then ExitLong("bx1-2",AtLimit,매도가격*1.10); if BH > 매도가격 * 1.05 and BH < 매도가격 * 1.1 and BH < 상한가 then { ExitLong("bx1-1-1",AtStop,매도가격*1.05); } } 즐거운 하루되세요 > 깜피 님이 쓴 글입니다. > 제목 : 문의드립니다. > 안녕하세요, 수식 작성에 도움을 주셔서 감사드립니다. 분할 매도 수식 문의드립니다. 일봉시스템이고 가격조건만족시 즉시 신호가 발생하게 해서 거래중입니다. 1. 시스템 성능을 개량하고자 분할매도를 백테스팅하려고 하는데, 가격이 B1으로 진입했을 때 매도가격에서 40%, 매도가격*1.05%에서 30%, 매도가격*1.1에서 나머지를 매도하려고 하고, 매도가격*1.1까지 가지 못하고 하락하는 경우 매도가격*1.05에서 전량 익절하려고 합니다. (당일청산) 단 매도가격이 상한가 근처여서 매도가격*1.05가 상한가를 넘어서는 경우는 익일에 수식을 적용하고 싶습니다. 수식 검토 부탁드립니다. 즐거운 주말 보내세요. if LatestEntryName(0) == "b1" Then { ExitLong("bx1",AtLimit,매도가격,"",MaxContracts*0.4,2); ExitLong("bx1-1%",AtLimit,매도가격*(1.05),"",MaxContracts*0.3,2); if H > 매도가격 * 1.05 and H<매도가격 * 1.1 then { ExitLong("bx1-1-1",AtStop,매도가격*1.05); } ExitLong("bx1-2",AtLimit,매도가격*(1.1)); }