커뮤니티

수식 수정 요청

프로필 이미지
깜피
2016-05-15 22:13:51
150
글번호 98084
답변완료
안녕하세요. 전에 작성해주신 수식을 가지고 거래를 하고 있는데 수정을 부탁드립니다. 맨 아래는 제가4.28에 남광토건(1분봉)으로 시뮬을 해본 결과인데 손절이 나왔음에도 불구하고 손절 봉에서 재매수가 나왔습니다. 타 종목으로 해보니까 익일 손절 후 재매수가 나오는 경우도 있었습니다. 그리고 분할 매수 식인데 분할 매수는 적용이 안되고 최초 매수 건이 손절 등으로 처리가 된 후에 2차 매수(BB)가 발생합니다. 1. 손절 발생 시 재매수 금지 2. 분할 매수 3. 매수 진입 시 진입 가격 대비 위 아래 호가 선택 해서 진입(예, 신호가 나오면 그 가격 대비 -5 호가로 진입) 4. 시가가 전일 종가 대비 5%로 시작하면 당일 거래 금지 5. 최초 진입 이후 수익률 5% 이상 넘어가면 trailingstop 5%(예를 들어 수익률 2%시 TS가 발동하면 추가 진입 부분하고 문제가 생길 수 있어서, 5% 수익 발생이전 까지는 TS 발동 금지) 5. 최초 거래 후 5% 이상 상승한 후 하락하여 2차 매수 선까지 올 경우 2차 매수 금지. 6. 매수물량이 남아 있을 경우 진입일 익익일에 전체 청산 / entrydate + 1로 하니까 영업일 기준으로는 안맞네요 ㅠ 요청사항이 너무 많아서 죄송합니다. 이렇게 수식 변경 부탁드리겠습니다. 감사합니다. input: 매수금액1(10000000),매수금액2(10000000),지정일(20160428); var : Ev(0),Xv(0),Xcond(false); if bdate != bdate[1] Then Xcond = false; if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then Xcond = true; if MarketPosition == 0 and NextBarSdate > sdate and NextBarSdate == 지정일 and Xcond == false Then buy("b",AtMarket,def,Floor(매수금액1/C)); if MarketPosition == 1 Then{ if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{ Condition11 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{ Condition12 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then Condition21 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then Condition22 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then Condition23 = true; if MaxEntries == 1 and CurrentContracts >= CurrentContracts[1] and Condition12 == false Then buy("bb",Atlimit,EntryPrice*0.98,Floor(매수금액2/C)); if CurrentContracts > CurrentContracts[1] Then{ Ev = AvgEntryPrice; Xv = Floor(MaxContracts*(1/3)); } if MaxEntries >=1 Then{ if Condition11 == false Then exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1); if Condition12 == false Then exitlong("BL3",AtStop,AvgEntryPrice*0.95); if Condition21 == false Then exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1); if Condition22 == false Then exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1); if Condition23 == false Then exitlong("BP3",AtLimit,AvgEntryPrice*1.20); } if sdate > EntryDate +1 and stime == 144500 Then exitlong(); } else{ Condition11 = false; Condition12 = false; Condition21 = false; Condition22 = false; Condition23 = false; } 진입일시 진입종류 진입명 진입가격(원) 수량 수익률(%) 최대수익(원) 진입효율 봉 개수 청산일시 청산종류 청산명 청산가격(원) 수익(원) 누적수익(원) 최대손실(원) 청산효율 총효율 2016-04-28 9:01 매수 b 13,750 245 -3.47 0 0 1 2016-04-28 9:02 매수청산 BL1 13,300 -116,877 -116,877 -110,250 0 -100 2016-04-28 9:01 매수 b 13,750 490 -5.29 0 0 10 2016-04-28 9:11 매수청산 BL3 13,050 -356,132 -473,009 -343,000 0 -100 2016-04-28 9:11 매수 bb 13,050 251 5.16 175,700 82.35 215 2016-04-28 12:51 매수청산 BP1 13,750 168,973 -304,036 -37,650 100 82.35 2016-04-28 9:11 매수 bb 13,050 251 10.13 338,850 90 220 2016-04-28 12:56 매수청산 BP2 14,400 331,960 27,924 -37,650 100 90 2016-04-28 9:11 매수 bb 13,050 252 4.39 504,000 93.02 1,006 2016-05-02 14:46 매수청산 _ExitLongNo1 13,650 144,471 172,395 -37,800 34.88 27.91
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2016-05-16 14:24:07

안녕하세요 예스스탁입니다. 1 해당식은 차트에 적용하실때 시스템 트레이딩 설정창의 피라미딩탭에서 피라미딩을 다른진입신호만 허용으로 설정하고 적용하셔야 합니다. 수식은 수식자체에서 진입을 누적하는 내용으로 작성해도 피라미딩탭에서 허용으로 지정하지 않으면 누적신호가 발생하지 않습니다. 추가매수가 나오지 않는 것은 피라미딩이 설정되지 않았기 때문이고 손절후 바로 재매수가 나온것은 손절되면 무포지션이 되고 해당 가격이 진입가격 이하이기 때문에 해당 신호로 신규로 진입하게 된것입니다. 피라미딩을 다른진입신호허용으로 설정하시면 모두 해결됩니다. 2 수식안에는 호가정보는 제공되지 않고 주문가격을 지정하는 부분도 없습니다. 실제주문가격은 시스템 트레이딩 설정창의 매매탭에서만 지정가능합니다. 3 익익일 청산가 트레일링스탑내용은 추가했습니다. input: 매수금액1(10000000),매수금액2(10000000),지정일(20160428); var : Ev(0),Xv(0),Xcond(false),Nday(0); if bdate != bdate[1] Then{ Nday = Nday+1; Xcond = false; } if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then Xcond = true; if MarketPosition == 0 and NextBarSdate > sdate and NextBarSdate == 지정일 and Xcond == false and NextBarOpen < C*1.05 Then buy("b",AtMarket,def,Floor(매수금액1/C)); if MarketPosition == 1 Then{ if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{ Condition11 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{ Condition12 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then Condition21 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then Condition22 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then Condition23 = true; if MaxEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice*1.05 and CurrentContracts >= CurrentContracts[1] and Condition12 == false Then buy("bb",Atlimit,EntryPrice*0.98,Floor(매수금액2/C)); if CurrentContracts > CurrentContracts[1] Then{ Ev = AvgEntryPrice; Xv = Floor(MaxContracts*(1/3)); } if MaxEntries >=1 Then{ if Condition11 == false Then exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1); if Condition12 == false Then exitlong("BL3",AtStop,AvgEntryPrice*0.95); if Condition21 == false Then exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1); if Condition22 == false Then exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1); if Condition23 == false Then exitlong("BP3",AtLimit,AvgEntryPrice*1.20); if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.95); } if sdate > Nday[BarsSinceEntry]+1 and stime == 144500 Then exitlong("bx"); } else{ Condition11 = false; Condition12 = false; Condition21 = false; Condition22 = false; Condition23 = false; } 즐거운 하루되세요 > 깜피 님이 쓴 글입니다. > 제목 : 수식 수정 요청 > 안녕하세요. 전에 작성해주신 수식을 가지고 거래를 하고 있는데 수정을 부탁드립니다. 맨 아래는 제가4.28에 남광토건(1분봉)으로 시뮬을 해본 결과인데 손절이 나왔음에도 불구하고 손절 봉에서 재매수가 나왔습니다. 타 종목으로 해보니까 익일 손절 후 재매수가 나오는 경우도 있었습니다. 그리고 분할 매수 식인데 분할 매수는 적용이 안되고 최초 매수 건이 손절 등으로 처리가 된 후에 2차 매수(BB)가 발생합니다. 1. 손절 발생 시 재매수 금지 2. 분할 매수 3. 매수 진입 시 진입 가격 대비 위 아래 호가 선택 해서 진입(예, 신호가 나오면 그 가격 대비 -5 호가로 진입) 4. 시가가 전일 종가 대비 5%로 시작하면 당일 거래 금지 5. 최초 진입 이후 수익률 5% 이상 넘어가면 trailingstop 5%(예를 들어 수익률 2%시 TS가 발동하면 추가 진입 부분하고 문제가 생길 수 있어서, 5% 수익 발생이전 까지는 TS 발동 금지) 5. 최초 거래 후 5% 이상 상승한 후 하락하여 2차 매수 선까지 올 경우 2차 매수 금지. 6. 매수물량이 남아 있을 경우 진입일 익익일에 전체 청산 / entrydate + 1로 하니까 영업일 기준으로는 안맞네요 ㅠ 요청사항이 너무 많아서 죄송합니다. 이렇게 수식 변경 부탁드리겠습니다. 감사합니다. input: 매수금액1(10000000),매수금액2(10000000),지정일(20160428); var : Ev(0),Xv(0),Xcond(false); if bdate != bdate[1] Then Xcond = false; if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then Xcond = true; if MarketPosition == 0 and NextBarSdate > sdate and NextBarSdate == 지정일 and Xcond == false Then buy("b",AtMarket,def,Floor(매수금액1/C)); if MarketPosition == 1 Then{ if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{ Condition11 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{ Condition12 = true; Xcond = true; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then Condition21 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then Condition22 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then Condition23 = true; if MaxEntries == 1 and CurrentContracts >= CurrentContracts[1] and Condition12 == false Then buy("bb",Atlimit,EntryPrice*0.98,Floor(매수금액2/C)); if CurrentContracts > CurrentContracts[1] Then{ Ev = AvgEntryPrice; Xv = Floor(MaxContracts*(1/3)); } if MaxEntries >=1 Then{ if Condition11 == false Then exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1); if Condition12 == false Then exitlong("BL3",AtStop,AvgEntryPrice*0.95); if Condition21 == false Then exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1); if Condition22 == false Then exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1); if Condition23 == false Then exitlong("BP3",AtLimit,AvgEntryPrice*1.20); } if sdate > EntryDate +1 and stime == 144500 Then exitlong(); } else{ Condition11 = false; Condition12 = false; Condition21 = false; Condition22 = false; Condition23 = false; } 진입일시 진입종류 진입명 진입가격(원) 수량 수익률(%) 최대수익(원) 진입효율 봉 개수 청산일시 청산종류 청산명 청산가격(원) 수익(원) 누적수익(원) 최대손실(원) 청산효율 총효율 2016-04-28 9:01 매수 b 13,750 245 -3.47 0 0 1 2016-04-28 9:02 매수청산 BL1 13,300 -116,877 -116,877 -110,250 0 -100 2016-04-28 9:01 매수 b 13,750 490 -5.29 0 0 10 2016-04-28 9:11 매수청산 BL3 13,050 -356,132 -473,009 -343,000 0 -100 2016-04-28 9:11 매수 bb 13,050 251 5.16 175,700 82.35 215 2016-04-28 12:51 매수청산 BP1 13,750 168,973 -304,036 -37,650 100 82.35 2016-04-28 9:11 매수 bb 13,050 251 10.13 338,850 90 220 2016-04-28 12:56 매수청산 BP2 14,400 331,960 27,924 -37,650 100 90 2016-04-28 9:11 매수 bb 13,050 252 4.39 504,000 93.02 1,006 2016-05-02 14:46 매수청산 _ExitLongNo1 13,650 144,471 172,395 -37,800 34.88 27.91