커뮤니티

시스템 수식 점검 및 수정 부탁드립니다.

프로필 이미지
회원
2015-03-20 20:20:29
143
글번호 84261
답변완료
아래의 수식으로 적용해보니 양봉이고 전일종가보다 주가가 높은데 매도가 안되는 날이 있습니다. 확인 좀 부탁드립니다. 그리고 수식의 조건을 수정도 부탁드리겠습니다. 매수조건 1. 음봉의 종가(144800) - 144800의 의미는 그 시간대에 형성된 가격. 즉, 봉이 없어서도 형성된 가격에 매수 2. 전일종가보다 높은 음봉의 종가에서는 매수 안함 3. 분할매수 매도조건 1. 양봉의 종가(144800)- 144800의 의미는 그 시간대에 형성된 가격. 즉, 봉이 없어서도 형성된 가격에 매도 2. 분할매도 3. 상한가 발생시 즉시 전량 매도 (혹시 거래량 부족으로 잔량이 남는 경우는 다음 양봉에 매도) 4. 매수가 보다 낮을 경우는 매도 안함 (매수 평단가가 계산되면 더 좋구요. 평단가 계산이 안되면 매수가 중 가장 낮은 가격보다 높으면 됩니다.) - 아 래 - 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 UpLimit = (BP[0] * 1.15); 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; } } input : 수량 (100); if stime == 144800 and C < DayOpen And C < DayClose(1) Then buy("매수",OnClose,def,수량); if stime == 144800 and C > DayOpen And C > DayClose(1) Then ExitLong("매도1",OnClose,def,"",수량,2); if MarketPosition == 1 and H < 상한가 Then ExitLong("매도2",Atlimit,상한가);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2015-03-23 10:17:01

안녕하세요 예스스탁입니다. 수식은 봉을 기준으로 조건을 판단합니다. 지정한 시간의 봉이 없으면 신호가 발생할수 없습니다. 기존식은 지정한 시간에 종가가 시초가 보다 높으냐 낮으냐를 판단해 신호가 발생합니다. 지정한 시간봉이 음봉인지 양봉인지를 판단해 진입하게 했습니다. 하나의 봉의 양봉은 C > O, 음봉은 C < O 시초가대비 양봉은 C > dayopen, 음봉은 C < dayopen 입니다. 식작성에 참고하시기 바랍니다. input : 수량 (100); 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 UpLimit = (BP[0] * 1.15); 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 stime == 144800 and C < O and C < DayClose(1) Then buy("매수",OnClose,def,수량); if MarketPosition == 1 Then{ #상한가 발생시 전량매도 if MarketPosition == 1 and H < 상한가 Then ExitLong("상한가매도",Atlimit,상한가); #지정한 시간에 양봉이고 평단가보다 높으면 지정한 수량만큼 매도 if stime == 144800 and C > O and C > AvgEntryPrice Then exitlong("bx",OnClose,def,"", 수량,1); } 즐거운 하루되세요 > HI_so****** 님이 쓴 글입니다. > 제목 : 시스템 수식 점검 및 수정 부탁드립니다. > 아래의 수식으로 적용해보니 양봉이고 전일종가보다 주가가 높은데 매도가 안되는 날이 있습니다. 확인 좀 부탁드립니다. 그리고 수식의 조건을 수정도 부탁드리겠습니다. 매수조건 1. 음봉의 종가(144800) - 144800의 의미는 그 시간대에 형성된 가격. 즉, 봉이 없어서도 형성된 가격에 매수 2. 전일종가보다 높은 음봉의 종가에서는 매수 안함 3. 분할매수 매도조건 1. 양봉의 종가(144800)- 144800의 의미는 그 시간대에 형성된 가격. 즉, 봉이 없어서도 형성된 가격에 매도 2. 분할매도 3. 상한가 발생시 즉시 전량 매도 (혹시 거래량 부족으로 잔량이 남는 경우는 다음 양봉에 매도) 4. 매수가 보다 낮을 경우는 매도 안함 (매수 평단가가 계산되면 더 좋구요. 평단가 계산이 안되면 매수가 중 가장 낮은 가격보다 높으면 됩니다.) - 아 래 - 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 UpLimit = (BP[0] * 1.15); 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; } } input : 수량 (100); if stime == 144800 and C < DayOpen And C < DayClose(1) Then buy("매수",OnClose,def,수량); if stime == 144800 and C > DayOpen And C > DayClose(1) Then ExitLong("매도1",OnClose,def,"",수량,2); if MarketPosition == 1 and H < 상한가 Then ExitLong("매도2",Atlimit,상한가);