커뮤니티

문의드립니다.

프로필 이미지
체로키
2017-02-22 08:22:51
113
글번호 107112
답변완료
38569 참조하여 작업중인데, 손절부분에서 동작하지 않습니다. (예:-10% 전체손절) 도움 부탁드립니다. 적용주식명 : 씨씨에스 ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100)); 아울러, 전체손실 -5%에 현재보유물량의 50% 손절 전체손실 -10%에서 나머지보유물량 전체손절 전체수익 5%에서 현재보유물량의 30% 익절 전체수익 10%에서 현재보유물량의 30% 익절 전체수익 15%에서 나머지보유물량 전체익절 전체손절을 실행한 경우, 일주일(5영업일) 후 초기재매수 시작 추가식 부탁드립니다. 감사합니다. --------------------------------------------------------- input : 투자금액(1000000),Per(1),첫진입시각(90000),첫진입날짜(20170116),Profit(5),Loss(10); var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0); if MarketPosition == 0 and stime == 첫진입시각 and sdate == 첫진입날짜 Then{ Mny3 = 투자금액+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol1 = int(int((투자금액)/C)/10)*10; vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol1 = int((투자금액)/C); vol2 = int((투자금액-투자금액*0.3)/C); vol3 = int((Mny3)/C); } UpVal = c; DnVal = c; buy("b",OnClose,def,vol1); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{ UpVal = LatestEntryPrice(0); UPCnt = upcnt+1; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; } Else{ vol2 = int((투자금액-투자금액*0.3)/C); } } if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{ DnVal = LatestEntryPrice(0); DnCnt = Dncnt+1; Mny3 = Mny3+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol3 = int((Mny3)/C); } } buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2); buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3); ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100)); ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100)); } if MarketPosition != 0 Then{ Upcnt = 0; Dncnt = 0; }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-02-22 13:41:58

안녕하세요 예스스탁입니다. input : 투자금액(1000000),Per(1),첫진입시각(90000),첫진입날짜(20170116),Profit1(5),Profit2(10),Profit3(15),Loss1(5),loss2(10); var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0); var : BLcond1(false),BLcond2(false),BPcond1(false),BPcond2(false),BPcond3(false); var : Didx(0),Xday(0),Xcond(false); if Bdate != Bdate[1] Then Didx = Didx+1; if TotalTrades > TotalTrades[1] and MarketPosition == 0 Then{ Xday = Didx; Xcond = false; if IsExitName("BL1",1) == true or IsExitName("BL2",1) == true Then Xcond = true; } if MarketPosition == 0 and ((stime == 첫진입시각 and sdate == 첫진입날짜) or (Xcond == true and Didx >= Xday+5)) Then{ Mny3 = 투자금액+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol1 = int(int((투자금액)/C)/10)*10; vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol1 = int((투자금액)/C); vol2 = int((투자금액-투자금액*0.3)/C); vol3 = int((Mny3)/C); } UpVal = c; DnVal = c; buy("b",OnClose,def,vol1); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{ UpVal = LatestEntryPrice(0); UPCnt = upcnt+1; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; } Else{ vol2 = int((투자금액-투자금액*0.3)/C); } } if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{ DnVal = LatestEntryPrice(0); DnCnt = Dncnt+1; Mny3 = Mny3+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol3 = int((Mny3)/C); } } buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2); buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3); if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then BLcond1 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then BLcond2 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then BPcond1 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then BPcond2 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then BPcond3 = true; if BPcond1 == false Then ExitLong("BP1",atlimit,AvgEntryPrice*(1+Profit1/100),"",Floor(MaxContracts*0.3),1); if BPcond2 == false Then ExitLong("BP2",atlimit,AvgEntryPrice*(1+Profit2/100),"",Floor(MaxContracts*0.3),1); if BPcond3 == false Then ExitLong("BP3",atlimit,AvgEntryPrice*(1+Profit3/100)); if BLcond1 == false Then ExitLong("BL1",AtStop,AvgEntryPrice*(1-Loss1/100),"",Floor(MaxContracts*0.5),1); if BLcond2 == false Then ExitLong("BL2",AtStop,AvgEntryPrice*(1-Loss2/100)); } if MarketPosition == 0 Then{ Upcnt = 0; Dncnt = 0; BLcond1 = false; BLcond2 = false; BPcond1 = false; BPcond2 = false; BPcond3 = false; } 즐거운 하루되세요 > 체로키 님이 쓴 글입니다. > 제목 : 문의드립니다. > 38569 참조하여 작업중인데, 손절부분에서 동작하지 않습니다. (예:-10% 전체손절) 도움 부탁드립니다. 적용주식명 : 씨씨에스 ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100)); 아울러, 전체손실 -5%에 현재보유물량의 50% 손절 전체손실 -10%에서 나머지보유물량 전체손절 전체수익 5%에서 현재보유물량의 30% 익절 전체수익 10%에서 현재보유물량의 30% 익절 전체수익 15%에서 나머지보유물량 전체익절 전체손절을 실행한 경우, 일주일(5영업일) 후 초기재매수 시작 추가식 부탁드립니다. 감사합니다. --------------------------------------------------------- input : 투자금액(1000000),Per(1),첫진입시각(90000),첫진입날짜(20170116),Profit(5),Loss(10); var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0); if MarketPosition == 0 and stime == 첫진입시각 and sdate == 첫진입날짜 Then{ Mny3 = 투자금액+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol1 = int(int((투자금액)/C)/10)*10; vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol1 = int((투자금액)/C); vol2 = int((투자금액-투자금액*0.3)/C); vol3 = int((Mny3)/C); } UpVal = c; DnVal = c; buy("b",OnClose,def,vol1); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{ UpVal = LatestEntryPrice(0); UPCnt = upcnt+1; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol2 = int(int((투자금액-투자금액*0.3)/C)/10)*10; } Else{ vol2 = int((투자금액-투자금액*0.3)/C); } } if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{ DnVal = LatestEntryPrice(0); DnCnt = Dncnt+1; Mny3 = Mny3+투자금액*0.3; if CodeCategoryEx == 11 and BasePrice < 50000 Then{ vol3 = int(int((Mny3)/C)/10)*10; } Else{ vol3 = int((Mny3)/C); } } buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2); buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3); ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100)); ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100)); } if MarketPosition != 0 Then{ Upcnt = 0; Dncnt = 0; }