커뮤니티

2일전상한가 수식 검증부탁드립니다

프로필 이미지
yesany
2012-05-27 20:18:22
401
글번호 51370
답변완료
상한가 검색에 대해여 질문 드립니다 게시판에 올려주신 2일전 상한가 수식인데요 실제적용해보면 맞게나오지 않습니다 귀찮으시겠지만 각 단락별 설명좀 부탁 드립니다 input : N(2); var : 상한가(0), UpLimit(0); var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(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; } 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 상한가 = 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 상한가 = iff(up6>=5000, up5, up6); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = up6; } } if H[N] >= 상한가[N] Then find(1);
검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2012-05-29 10:57:53

안녕하세요 예스스탁입니다. input : N(2); var : 상한가(0), UpLimit(0); var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0); if date >= 19981207 then { //거래소 98년 12월7일 가격제한폭 15%로 확대 변경됨 if date < 20050328 && CodeCategory() == 2 then //코스닥 2005년 3월28일 이전은 가격제한폭 12% UpLimit = (BP[0] * 1.12); Else //코스닥 2005년 3월28일 이후 및 거래소98년12월 7일이후 15% UpLimit = (BP[0] * 1.15); // 상한가가 기준가대비 15% or 12% 를 넘지않는 최대 호가 이므로 아래 내용은 최대호가를 계산하는 식입니다. // 제도 변경 시점 이전/이후별로, 가격대별 호가 감안해서, 코스피/코스닥 별로 값을 계산하는 내용입니다. // 기준가(baseprice,bp)를 기준으로 각 케이스 별로 값을 미리 계산하고 // 기준가 수준에 따라 6개 중 하나의 값을 사용하도록 한것입니다. if CodeCategory() == 2 then { //코스닥 호가단위 ( 2003년 7월21일에 호가 단위 변경됨) 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 { //003년 7월21일 이전 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 // 500,000원 이상의 상한가 호가 상한가 = up1; Else If BP >= 100000 Then // 100,000원 이상 ~ 500,000원 미만의 상한가 호가 상한가 = iff(up2>=500000, up1, up2); Else If BP >= 50000 Then // 50,000원 이상 ~ 100,000원 미만의 상한가 호가 상한가 = iff(up3>=100000, up2, up3); Else If BP >= 10000 Then // 10,000원 이상 ~ 50,000원 미만의 상한가 호가 상한가 = iff(up4>=50000, up3, up4); Else If BP >= 5000 Then // 5,000원 이상 ~ 10,000원 미만의 상한가 호가 상한가 = iff(up5>=10000, up4, up5); Else // 5,000원 미만의 상한가 호가 상한가 = iff(up6>=5000, up5, up6); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF는 up6을 사용 상한가 = up6; } } if H[N] >= 상한가[N] Then find(1); 가격대별로 값 계산시에 0.00001이 사용된 이유는 아래 링크 참고하시기 바랍니다. https://www.yesstock.com/board/Search_View.asp?db=board100036&num=49329&pageno=1&startpage=1&Kind=1&keyfield=Sub_Cont&keyword=+0.00001&Ext=0 즐거운 하루되세요 > yesany 님이 쓴 글입니다. > 제목 : 2일전상한가 수식 검증부탁드립니다 > 상한가 검색에 대해여 질문 드립니다 게시판에 올려주신 2일전 상한가 수식인데요 실제적용해보면 맞게나오지 않습니다 귀찮으시겠지만 각 단락별 설명좀 부탁 드립니다 input : N(2); var : 상한가(0), UpLimit(0); var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(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; } 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 상한가 = 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 상한가 = iff(up6>=5000, up5, up6); } else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF 상한가 = up6; } } if H[N] >= 상한가[N] Then find(1);