커뮤니티

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

프로필 이미지
승부사1
2017-08-28 20:21:45
192
글번호 112303
답변완료
추가 질문이 생겨서 문의 드립니다. 제가 프로그램을 구매해서 사용중입니다. 그런데 거기서는 아래의 조건들이 다 설정되어서 작동을 하고 있는 것을 확인하였습니다. 예를 들어서 예수금의 경우는 계좌평가에서 맨 위줄에 있는 계좌의 투자원금과 예수금을 체크하여 작동이 되는걸로 알고 있구요. 진입회수 제한과 1회 진입금액까지도 설정창에 별도 설정하지 않아도 작동 되고 있습니다. 매도의 경우도 봉이 완성되지 않아도 정상적으로 매도가 되고 있구요. 전고점은 좀 디테일하지는 않지만 챠트툴에 있는 지지저항선 중에서 일봉상의 직전고점의 종가(음봉인 경우는 시가)를 선택하면 될거 같습니다. 지수 참조데이터는 삭제해야 할거 같습니다. 다른 로직으로 대체해야 겠네요. 따지는거 아니므로 양해 바라구요. ㅎㅎ 구매한 프로그램이다보니 명령어를 볼수는 없습니다. 그리고 아래의 로직은 저의 매매 기법을 프로그램화 해볼수 있을까해서 올렸구요. 혹여 다른 방법이 있지는 않나 싶어서 제차 문의 드립니다. ==== 아 래 ==== 안녕하세요 예스스탁입니다. 1 랭귀지는 기본체계가 봉완성이고 시간도 완성봉 기준으로 판단합니다. 30분봉에서 15시15분 매수는 가능하지 않고 시스템은 장중에 신호가 발생되게 해야 하므로 30분봉에서 14시30분봉완성(15시봉시가수신) 될때가 정규장에서 조건체크할수 있는 마지막봉입니다. 14시30분봉 완성시 체크해서 15시봉 시가에 신호가 발생하게 작성했습니다. 식 작성에 참고하시기 바랍니다. 2 예수금제한등은 가능하지 않습니다. 3 코스피나 코스닥지수를 참조데이터(data2)로 추가하고 식 적용하셔야 합니다. 4 추가진입하는 수식은 반드시 적용시 피라미딩을 사용자분이 설정하셔야 합니다. 설정없이 수식에서 설정이 가능하지 않습니다. 5 전고점은 어떤 값인지 불명확합니다. 청산전략 중 전고점관련 내용은 제외한 수식입니다. 6 input : 매수금액(500000); var : cond(false),Xcond(false); 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; } } if MarketPosition == 0 and data2(C > ma(c,5)) and stime == 143000 and C < DayClose(1) and C < O then buy("b",OnClose,def,Floor((매수금액*0.25)/C)); if MarketPosition == 1 Then { if MaxEntries ==5 and C <= AvgEntryPrice*0.75 Then cond = true; if stime == 143000 and C < DayClose(1) and C < O and C < AvgEntryPrice then { if ((cond == false and MaxEntries > 1 and MaxEntries < 5) or (cond == true and MaxEntries > 5 and MaxEntries < 10)) then { buy("bb",OnClose,def,Floor((매수금액*0.25)/C)); } } if CurrentContracts > CurrentContracts[1] Then Xcond = false; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bp" Then Xcond = true; if Xcond == false then ExitLong("bp",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.50),2); if stime == 143000 and C > DayClose(1) and C > O and C > AvgEntryPrice*1.03 then exitlong("bx1",OnClose,def,"",Floor(MaxContracts*0.20),2); exitlong("Bx2",AtLimit,상한가); if stime == 143000 and C > DayClose(1) and DayClose(1) > DayClose(2) and DayClose(2) > DayClose(3) and DayClose(3) > DayClose(4) then exitlong("bx3",OnClose,def,"",Floor(MaxContracts*0.20),2); } Else{ cond = false; Xcond = false; } 즐거운 하루되세요 > 승부사1 님이 쓴 글입니다. > 제목 : 시스템수식 부탁드립니다. > # 매수전략 - 매수 시작일 설정 - 1회 매수 금액 500,000원 - 분할 매수 5회로 제한 (단, 5회 매수후 주가 지속하락하여 평단가대비 -25% 발생시 재작동하여 5회까지 분할 매수) - 코스피(코스닥) 지수가 일봉상 5일선 이하에서는 신규 매수 제한 (기 보유종목에 대한 매수는 진행) - 예수금이 투자원금의 15% 이하인 경우 신규 매수 제한 - 30분봉 챠트에 적용하며 전일종가보다 낮은 음봉이며 평단가보다 낮은 경우 151500에 매수 # 매도전략 - 전일종가보다 높은 양봉이며 평단가대비 3%이상 수익인 경우 151500에 보유 금액의 20% 매도 - 장중 평단가대비 10% 수익실현 즉시 보유 금액의 50% 매도 # 청산전략 &#8211; 조건만족 즉시 실행 &#8211; 재진입 금지 - 장중 상한가 도달시 전량매도 - 전일종가대비 높은 종가(양음봉 상관없이)가 연속되는 경우 4일째 되는 날 151500에 전량매도 - 거래량 60이평선의 3배이상의 거래량이 발생하고 전고점의 종가보다 주가가 낮으면 전량매도 - 거래량 60이평선의 3배이상의 거래량이 발생하고 전고점을 종가를 상승돌파하였다가 다시 하향이탈시 전량매도 피라미딩, 매수금액 설정없이 작동되게 부탁드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-08-30 10:38:21

안녕하세요 예스스탁입니다. 1 예수금의 경우 함수로 리턴이 되는데 실시간에서만 값이 리턴되고 차트의 과거봉에는 모두 0만 리턴이 됩니다. 투자원금은 리턴되는 함수가 없습니다. 과거 시뮬레이션을 위해서 예수금이 0(시뮬)일때는 예수금 조건없이 진입하게 하고 예수금이 0보다 큰 금액(실시간)에서는 150만원보다 클때만 진입하지 않게 식을 수정해 드립니다. 해당 부분은 사용자분이 차트에서 값리턴 해서 의도에 맞게 수정해 보셔야 할것 같습니다. 2 1회매수금액은 내부변수 처리로 변경했습니다. 피라미딩은 무조건 설정창에서 지정하셔야 합니다. 수식에서 처리할수 없는 부분입니다. 3 참조데이터 대신에 일봉상 가장 최근 swinghigh값을 이상에 종가가 위치할때만 진입하게 수정했습니다. 수식 내용 확인하시기 바랍니다. 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 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; } } #일간 SwingHigh var : N(3); //고저점기준 N봉 var : Right(false),Left(false),cnt(0),HH(0); Right = true; Left = true; for cnt = 0 to N-1{ if dayhigh(N) <= dayhigh(cnt) Then Right = false; if dayhigh(N) < dayhigh(N+1+cnt) Then Left = false; } if Right == true and Left == true Then HH = dayhigh(N); input : 지정일(20170801); var : 매수금액(500000); //내부변수로 지정 var : cond(false),Xcond(false); var : v1(0),V2(0); #계좌목록의 첫번째 계좌의 예수금 v1 = GetUnclearedDeposits(GetAccount(0)); if sdate >= 지정일 and MarketPosition == 0 and C > HH and (V1 == 0 or V1 >= 15000000) and stime == 143000 and C < DayClose(1) and C < O then buy("b",OnClose,def,Floor((매수금액*0.25)/C)); if MarketPosition == 1 Then { if MaxEntries == 5 and C <= AvgEntryPrice*0.75 Then cond = true; if stime == 143000 and C < DayClose(1) and C < O and C < AvgEntryPrice then { if ((cond == false and MaxEntries > 1 and MaxEntries < 5) or (cond == true and MaxEntries > 5 and MaxEntries < 10)) then { buy("bb",OnClose,def,Floor((매수금액*0.25)/C)); } } if CurrentContracts > CurrentContracts[1] Then Xcond = false; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bp" Then Xcond = true; if Xcond == false then ExitLong("bp",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.50),2); if stime == 143000 and C > DayClose(1) and C > O and C > AvgEntryPrice*1.03 then exitlong("bx1",OnClose,def,"",Floor(MaxContracts*0.20),2); exitlong("Bx2",AtLimit,상한가); if stime == 143000 and C > DayClose(1) and DayClose(1) > DayClose(2) and DayClose(2) > DayClose(3) and DayClose(3) > DayClose(4) then exitlong("bx3",OnClose,def,"",Floor(MaxContracts*0.20),2); } Else{ cond = false; Xcond = false; } 즐거운 하루되세요 > 승부사1 님이 쓴 글입니다. > 제목 : 시스템 수식 수정 부탁드립니다. > 추가 질문이 생겨서 문의 드립니다. 제가 프로그램을 구매해서 사용중입니다. 그런데 거기서는 아래의 조건들이 다 설정되어서 작동을 하고 있는 것을 확인하였습니다. 예를 들어서 예수금의 경우는 계좌평가에서 맨 위줄에 있는 계좌의 투자원금과 예수금을 체크하여 작동이 되는걸로 알고 있구요. 진입회수 제한과 1회 진입금액까지도 설정창에 별도 설정하지 않아도 작동 되고 있습니다. 매도의 경우도 봉이 완성되지 않아도 정상적으로 매도가 되고 있구요. 전고점은 좀 디테일하지는 않지만 챠트툴에 있는 지지저항선 중에서 일봉상의 직전고점의 종가(음봉인 경우는 시가)를 선택하면 될거 같습니다. 지수 참조데이터는 삭제해야 할거 같습니다. 다른 로직으로 대체해야 겠네요. 따지는거 아니므로 양해 바라구요. ㅎㅎ 구매한 프로그램이다보니 명령어를 볼수는 없습니다. 그리고 아래의 로직은 저의 매매 기법을 프로그램화 해볼수 있을까해서 올렸구요. 혹여 다른 방법이 있지는 않나 싶어서 제차 문의 드립니다. ==== 아 래 ==== 안녕하세요 예스스탁입니다. 1 랭귀지는 기본체계가 봉완성이고 시간도 완성봉 기준으로 판단합니다. 30분봉에서 15시15분 매수는 가능하지 않고 시스템은 장중에 신호가 발생되게 해야 하므로 30분봉에서 14시30분봉완성(15시봉시가수신) 될때가 정규장에서 조건체크할수 있는 마지막봉입니다. 14시30분봉 완성시 체크해서 15시봉 시가에 신호가 발생하게 작성했습니다. 식 작성에 참고하시기 바랍니다. 2 예수금제한등은 가능하지 않습니다. 3 코스피나 코스닥지수를 참조데이터(data2)로 추가하고 식 적용하셔야 합니다. 4 추가진입하는 수식은 반드시 적용시 피라미딩을 사용자분이 설정하셔야 합니다. 설정없이 수식에서 설정이 가능하지 않습니다. 5 전고점은 어떤 값인지 불명확합니다. 청산전략 중 전고점관련 내용은 제외한 수식입니다. 6 input : 매수금액(500000); var : cond(false),Xcond(false); 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; } } if MarketPosition == 0 and data2(C > ma(c,5)) and stime == 143000 and C < DayClose(1) and C < O then buy("b",OnClose,def,Floor((매수금액*0.25)/C)); if MarketPosition == 1 Then { if MaxEntries ==5 and C <= AvgEntryPrice*0.75 Then cond = true; if stime == 143000 and C < DayClose(1) and C < O and C < AvgEntryPrice then { if ((cond == false and MaxEntries > 1 and MaxEntries < 5) or (cond == true and MaxEntries > 5 and MaxEntries < 10)) then { buy("bb",OnClose,def,Floor((매수금액*0.25)/C)); } } if CurrentContracts > CurrentContracts[1] Then Xcond = false; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bp" Then Xcond = true; if Xcond == false then ExitLong("bp",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.50),2); if stime == 143000 and C > DayClose(1) and C > O and C > AvgEntryPrice*1.03 then exitlong("bx1",OnClose,def,"",Floor(MaxContracts*0.20),2); exitlong("Bx2",AtLimit,상한가); if stime == 143000 and C > DayClose(1) and DayClose(1) > DayClose(2) and DayClose(2) > DayClose(3) and DayClose(3) > DayClose(4) then exitlong("bx3",OnClose,def,"",Floor(MaxContracts*0.20),2); } Else{ cond = false; Xcond = false; } 즐거운 하루되세요 > 승부사1 님이 쓴 글입니다. > 제목 : 시스템수식 부탁드립니다. > # 매수전략 - 매수 시작일 설정 - 1회 매수 금액 500,000원 - 분할 매수 5회로 제한 (단, 5회 매수후 주가 지속하락하여 평단가대비 -25% 발생시 재작동하여 5회까지 분할 매수) - 코스피(코스닥) 지수가 일봉상 5일선 이하에서는 신규 매수 제한 (기 보유종목에 대한 매수는 진행) - 예수금이 투자원금의 15% 이하인 경우 신규 매수 제한 - 30분봉 챠트에 적용하며 전일종가보다 낮은 음봉이며 평단가보다 낮은 경우 151500에 매수 # 매도전략 - 전일종가보다 높은 양봉이며 평단가대비 3%이상 수익인 경우 151500에 보유 금액의 20% 매도 - 장중 평단가대비 10% 수익실현 즉시 보유 금액의 50% 매도 # 청산전략 &#8211; 조건만족 즉시 실행 &#8211; 재진입 금지 - 장중 상한가 도달시 전량매도 - 전일종가대비 높은 종가(양음봉 상관없이)가 연속되는 경우 4일째 되는 날 151500에 전량매도 - 거래량 60이평선의 3배이상의 거래량이 발생하고 전고점의 종가보다 주가가 낮으면 전량매도 - 거래량 60이평선의 3배이상의 거래량이 발생하고 전고점을 종가를 상승돌파하였다가 다시 하향이탈시 전량매도 피라미딩, 매수금액 설정없이 작동되게 부탁드립니다.