커뮤니티

상 수식부탁드리겠습니다.

프로필 이미지
신나는파파
2013-08-26 21:53:06
141
글번호 66850
답변완료
수고하십니다. 상한가 수식 몇개가 더 필요해서요 부탁드리겠습니다. 상한가0 = 전일 상한가 가격; 상한가1 = 당일 상한가 가격; 상한가2 = 다음날 상한가 가격; 상한가3 = 5일중 가장최근 상한가 가격; 상한가4 = 최근5일을 제외한 20일중 가장최근 상한가 가격; 상한가5 = 최근20일을 제외한 60일중 가장최근 상한가 가격; 이렇게 수식부탁드립니다. 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-08-27 16:16:33

안녕하세요 예스스탁입니다. var : 내일상한가(0); var : cnt(0),up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),UpLimit(0); var : up11(0), up22(0), up33(0), up44(0), up55(0),up66(0),UpLimit1(0); Array : 상한가[100](0); if date != date[1] Then{ for cnt = 0 to 99{ 상한가[cnt] = 상한가[cnt-1][1]; } } 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; } 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; } } 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; } if CodeCategory() == 1 || CodeCategory() == 2 then { If BP >= 500000 Then 상한가[0] = up1; Else If BP >= 100000 Then 상한가[0] = iff(up2>=500000, up1, up2); Else If BP >= 50000 Then 상한가[0] = iff(up3>=100000, up2, up3); Else If BP >= 10000 Then 상한가[0] = iff(up4>=50000, up3, up4); Else If BP >= 5000 Then 상한가[0] = iff(up5>=10000, up4, up5); Else 상한가[0] = iff(up6>=5000, up5, up6); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가[0] = up6; } } if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then UpLimit1 = (DayClose[0] * 1.12); Else UpLimit1 = (DayClose[0] * 1.15); if CodeCategory() == 2 then { if date >= 20030721 then { up11 = int(UpLimit1/100+0.00001)*100; up22 = int(UpLimit1/100+0.00001)*100; up33 = int(UpLimit1/100+0.00001)*100; up44 = int(UpLimit1/50+0.00001)*50; up55 = int(UpLimit1/10+0.00001)*10; up66 = int(UpLimit1/5+0.00001)*5; } else { up11 = int(UpLimit1/1000+0.00001)*1000; up22 = int(UpLimit1/500+0.00001)*500; up33 = int(UpLimit1/100+0.00001)*100; up44 = int(UpLimit1/50+0.00001)*50; up55 = int(UpLimit1/10+0.00001)*10; up66 = int(UpLimit1/10+0.00001)*10; } } Else { up11 = int(UpLimit1/1000+0.00001)*1000; up22 = int(UpLimit1/500+0.00001)*500; up33 = int(UpLimit1/100+0.00001)*100; up44 = int(UpLimit1/50+0.00001)*50; up55 = int(UpLimit1/10+0.00001)*10; up66 = int(UpLimit1/5+0.00001)*5; } if CodeCategory() == 1 || CodeCategory() == 2 then { If DayClose >= 500000 Then 내일상한가 = up11; Else If DayClose >= 100000 Then 내일상한가 = iff(up22>=500000, up11, up22); Else If DayClose >= 50000 Then 내일상한가 = iff(up33>=100000, up22, up33); Else If DayClose >= 10000 Then 내일상한가 = iff(up44>=50000, up33, up44); Else If DayClose >= 5000 Then 내일상한가 = iff(up55>=10000, up44, up55); Else 내일상한가 = iff(up66>=5000, up55, up66); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 내일상한가 = up66; } } var : 상한가3(0),상한가4(0),상한가5(0),cnt3(0),cnt4(0),cnt5(0); 상한가3 = -1; for cnt3 = 0 to 4{ if dayhigh(cnt3) >= 상한가[cnt3] Then{ 상한가3 = 상한가[cnt3]; cnt3 = 1000; } } 상한가4 = -1; for cnt4 = 5 to 19{ if dayhigh(cnt4) >= 상한가[cnt4] Then{ 상한가4 = 상한가[cnt4]; cnt4 = 1000; } } 상한가5 = -1; for cnt5 = 20 to 59{ if dayhigh(cnt5) >= 상한가[cnt5] Then{ 상한가5 = 상한가[cnt5]; cnt5 = 1000; } } plot1(상한가[0],"당일"); plot2(상한가[1],"전일"); plot3(내일상한가,"내일"); plot4(상한가3,"상한가3"); plot5(상한가4,"상한가4"); plot6(상한가5,"상한가5"); 상한가는 종목의 기준가격(BasePrice)를 기준으로 계산됩니다. 내일의 BasePrice는 알수 없으므로 당일종가를 기준으로 계산했습니다 상한가3 = 5일중 가장최근 상한가 가격; 상한가4 = 최근5일을 제외한 20일중 가장최근 상한가 가격; 상한가5 = 최근20일을 제외한 60일중 가장최근 상한가 가격; 지정된 기간안에 상한가가 발생한 날이 없으면 -1이 리턴됩니다. 즐거운 하루되세요 > 신나는파파 님이 쓴 글입니다. > 제목 : 상 수식부탁드리겠습니다. > 수고하십니다. 상한가 수식 몇개가 더 필요해서요 부탁드리겠습니다. 상한가0 = 전일 상한가 가격; 상한가1 = 당일 상한가 가격; 상한가2 = 다음날 상한가 가격; 상한가3 = 5일중 가장최근 상한가 가격; 상한가4 = 최근5일을 제외한 20일중 가장최근 상한가 가격; 상한가5 = 최근20일을 제외한 60일중 가장최근 상한가 가격; 이렇게 수식부탁드립니다. 감사합니다.