커뮤니티

현재 사용 수식에 매수 조건 추가 부탁드림니다.

프로필 이미지
이형지
2023-07-09 05:48:03
950
글번호 170452
답변완료
기존 사용 수식 국내주식(삼성전자) 60분봉적용 매수 일봉에서 일정 하락하면 분할 매수 및 수익시 분할 청산하는 수식임 추가로 넣어야할 기능은 다음과 같습니다. 매수 조건 1.일정하락시 분할매수 ( 유지 ) --> 현재 수식 적용중 2.최초 진입한 값에서 10% 15% 20% 25% 30% 35% ..... 등등 일정 하락했을때 각각 10주씩 매수하는 수식을 첨가하고 싶습니다. (1회성 매수 ) --> 추가로 요청하는 조건 그외 조건은 동일합니다. 수식 추가 부탁드림니다. -------------기존 사용 수식------------- input : 시작일(10200216); input : 이평1(240),이평2(2880); input : 최대투자금액(2000); input : 수익퍼센트(8); var : cond(False),XV(0),vol(0); var1 = ma(C,이평1); Var2 = ma(C,이평2); if Data1(sDate) >= 시작일 Then { if sTime == 140000 and AvgEntryPrice*CurrentContracts < 최대투자금액*10000 Then { if c < var1 or c < Var2 Then # 분봉 이하일때 매수 진입 { if C <= DayClose(1)*0.98 and C > DayClose(1)*0.975 Then Buy("b1",OnClose,Def,1); if C <= DayClose(1)*0.975 and C > DayClose(1)*0.970 Then Buy("b2",OnClose,Def,2); if C <= DayClose(1)*0.970 and C > DayClose(1)*0.965 Then Buy("b3",OnClose,Def,3); if C <= DayClose(1)*0.965 and C > DayClose(1)*0.960 Then Buy("b4",OnClose,Def,4); if C <= DayClose(1)*0.960 and C > DayClose(1)*0.955 Then Buy("b5",OnClose,Def,5); if C <= DayClose(1)*0.955 and C > DayClose(1)*0.95 Then Buy("b6",OnClose,Def,6); if C <= DayClose(1)*0.95 and C > DayClose(1)*0.945 Then Buy("b7",OnClose,Def,7); if C <= DayClose(1)*0.945 and C > DayClose(1)*0.94 Then Buy("b8",OnClose,Def,8); if C <= DayClose(1)*0.94 Then Buy("b9",OnClose,Def,9); } } } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { XV = CurrentContracts; cond = False; } if C >= AvgEntryPrice*(1+수익퍼센트*0.01) and sTime == 140000 and c > var1 and c > var2 Then { if XV >= 100 Then vol = Floor(XV*0.01); # 계약수가 100개 이상일때 1% 분할매도 else if XV < 100 and XV >= 50 Then vol = Floor(XV*0.02); # 계약수가 50개~100 일때 2% 분할매도 else if XV < 50 and XV >= 20 Then vol = Floor(XV*0.05); # 계약수가 20개~50 일때 5% 분할매도 else if XV < 20 and XV >= 10 Then vol = Floor(XV*0.10); # 계약수가 10개~20 일때 10% 분할매도 Else vol = Floor(XV*0.50); # 계약수가 10개이하 일때 50% 분할매도 ExitLong("bx",OnClose,Def,"",vol,2); } } Else cond = False;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-07-10 10:56:59

> 이형지 님이 쓴 글입니다. > 제목 : 현재 사용 수식에 매수 조건 추가 부탁드림니다. > 기존 사용 수식 국내주식(삼성전자) 60분봉적용 매수 일봉에서 일정 하락하면 분할 매수 및 수익시 분할 청산하는 수식임 추가로 넣어야할 기능은 다음과 같습니다. 매수 조건 1.일정하락시 분할매수 ( 유지 ) --> 현재 수식 적용중 2.최초 진입한 값에서 10% 15% 20% 25% 30% 35% ..... 등등 일정 하락했을때 각각 10주씩 매수하는 수식을 첨가하고 싶습니다. (1회성 매수 ) --> 추가로 요청하는 조건 그외 조건은 동일합니다. 수식 추가 부탁드림니다. -------------기존 사용 수식------------- input : 시작일(10200216); input : 이평1(240),이평2(2880); input : 최대투자금액(2000); input : 수익퍼센트(8); var : cond(False),XV(0),vol(0); var1 = ma(C,이평1); Var2 = ma(C,이평2); if Data1(sDate) >= 시작일 Then { if sTime == 140000 and AvgEntryPrice*CurrentContracts < 최대투자금액*10000 Then { if c < var1 or c < Var2 Then # 분봉 이하일때 매수 진입 { if C <= DayClose(1)*0.98 and C > DayClose(1)*0.975 Then Buy("b1",OnClose,Def,1); if C <= DayClose(1)*0.975 and C > DayClose(1)*0.970 Then Buy("b2",OnClose,Def,2); if C <= DayClose(1)*0.970 and C > DayClose(1)*0.965 Then Buy("b3",OnClose,Def,3); if C <= DayClose(1)*0.965 and C > DayClose(1)*0.960 Then Buy("b4",OnClose,Def,4); if C <= DayClose(1)*0.960 and C > DayClose(1)*0.955 Then Buy("b5",OnClose,Def,5); if C <= DayClose(1)*0.955 and C > DayClose(1)*0.95 Then Buy("b6",OnClose,Def,6); if C <= DayClose(1)*0.95 and C > DayClose(1)*0.945 Then Buy("b7",OnClose,Def,7); if C <= DayClose(1)*0.945 and C > DayClose(1)*0.94 Then Buy("b8",OnClose,Def,8); if C <= DayClose(1)*0.94 Then Buy("b9",OnClose,Def,9); } } } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { XV = CurrentContracts; cond = False; } if C >= AvgEntryPrice*(1+수익퍼센트*0.01) and sTime == 140000 and c > var1 and c > var2 Then { if XV >= 100 Then vol = Floor(XV*0.01); # 계약수가 100개 이상일때 1% 분할매도 else if XV < 100 and XV >= 50 Then vol = Floor(XV*0.02); # 계약수가 50개~100 일때 2% 분할매도 else if XV < 50 and XV >= 20 Then vol = Floor(XV*0.05); # 계약수가 20개~50 일때 5% 분할매도 else if XV < 20 and XV >= 10 Then vol = Floor(XV*0.10); # 계약수가 10개~20 일때 10% 분할매도 Else vol = Floor(XV*0.50); # 계약수가 10개이하 일때 50% 분할매도 ExitLong("bx",OnClose,Def,"",vol,2); } } Else cond = False;