커뮤니티

수식 부탁드립니다.

프로필 이미지
다낚아
2020-01-15 11:00:19
169
글번호 135153
답변완료
항상 도움주셔서 감사드립니다. 코딩실력이 부족해서 버그처리가 어렵네요. 아래 조건의 수식 부탁드립니다. 조건검색은 잘돼는데 날짜/시간설정하고 나면 안돼네요.. 실시간챠트 당일 첫봉에 매수가 찍히네요..(1분봉데이매매) 조건A : countif(condition1==true,10) > 5; 1. 검색시간 : 9:00 ~ 9:20분 까지 조건A검색 만족시 var1=1할당 매수시간 : 조건A만족후 var1==1 에 조건B 만족시 매수 2. 보유종목이 상한가인경우와 조건C에 만족하는 경우 당일매도안하고 익일로 이전 그외 종목은 setstopEndofday로 매도 (상한가시 익일시가매도설정되어 있는데 같은 상한가에 어떤건 이전 되고 어떤건 당일청산되고 그러네요) 위 수식좀 부탁드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-01-15 15:08:00

안녕하세요 예스스탁입니다. 1 종목검색과 시스템이 자동연결되지 않습니다. 시스템식만 작성해 드립니다. 9시~9시20분 사이에 조건A가 만족한 봉이 있으면 var1은 1이되고 9시 20분 이후에 var1이 1이고 조건 B만족하면 매수입니다. if bdate != bdate[1] Then var1 = 0; if stime >= 90000 and stime < 92000 Then { if countif(condition1==true,10) > 5 Then var1 = 1; } if stime >= 92000 and var1 == 1 and 조건B Then buy(); 2 사용하시는 수식이 어떤식으로 구현이 되었는지 모르겠습니다. 당일청산은 15시10분이고 당일 상한가를 한번이상 달성하거나, 조건C에 한번이상 충족되면 당일청산은 해제하고 다음날시가에 청산하게 작성해 드립니다. 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; } } #당일 시작시 당일청산을 15시10분으로 서정 if bdate != bdate[1] Then SetStopEndofday(151000) #당일 상한가를 한번이상 달성하면 당일청산해제 if H >= 상한가 Then SetStopEndofday(0); #당일 조건C를 한번이상 달성하면 당일청산해제 if H >= 상한가 Then SetStopEndofday(0); #청산안되고 다음날로 넘어가면 시가 if MarketPosition == 1 and NextBarSdate > sdate then { ExitLong("bx",AtMarket); } 즐거운 하루되세요 > 다낚아 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다. > 항상 도움주셔서 감사드립니다. 코딩실력이 부족해서 버그처리가 어렵네요. 아래 조건의 수식 부탁드립니다. 조건검색은 잘돼는데 날짜/시간설정하고 나면 안돼네요.. 실시간챠트 당일 첫봉에 매수가 찍히네요..(1분봉데이매매) 조건A : countif(condition1==true,10) > 5; 1. 검색시간 : 9:00 ~ 9:20분 까지 조건A검색 만족시 var1=1할당 매수시간 : 조건A만족후 var1==1 에 조건B 만족시 매수 2. 보유종목이 상한가인경우와 조건C에 만족하는 경우 당일매도안하고 익일로 이전 그외 종목은 setstopEndofday로 매도 (상한가시 익일시가매도설정되어 있는데 같은 상한가에 어떤건 이전 되고 어떤건 당일청산되고 그러네요) 위 수식좀 부탁드립니다.