커뮤니티

질문드립니다.

프로필 이미지
부자청년28
2011-05-19 00:57:51
649
글번호 38804
답변완료
일봉 30일선을 기준으로 하고 분봉에다가 적용시키는시스템 식입니다. 아래식에서 3차매수후에 주가가 올라서 매도가 되자마자 그다음봉에서 재매수가 일어나는데요. 당일 매도가 일어나면 당일 재매수가 안일어나게 하고 싶습니다. input : p1(30), capital(10000000); var : cnt(0),count(0),Xcount(0),sumv(0),mav(0); Condition1 = date==exitdate(1) And MarketPosition(1) == 1; count = 0; Xcount = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) Then count = count+1; if sdate == ExitDate(cnt) Then Xcount = Xcount+1; } if CodeCategory == 1 Then{ value1 = int(int((capital*0.1)/C)/10)*10; value2 = int(int((capital*0.3)/C)/10)*10; value3 = int(int((capital*0.6)/C)/10)*10; } if CodeCategory == 2 Then{ value1 = int((capital*0.1)/C); value2 = int((capital*0.3)/C); value3 = int((capital*0.6)/C); } sumV = 0; for count = 1 to p1-1 { sumV = sumV+DayClose(count); } maV = (sumV+dayopen()) / p1; if condition1 == false Then{ if MarketPosition == 0 and H <= maV*1.02 and L >= maV*0.98 Then buy("1매수",OnClose,def,value1); if MarketPosition == 1 Then{ buy("2매수",atlimit,EntryPrice*0.92,value2); buy("3매수",atlimit,EntryPrice*0.82,value3); } } if MarketPosition == 1 Then{ if CodeCategory == 1 Then{ value11 = int(int((CurrentContracts*0.5)/10)*10); value12 = int(int((CurrentContracts*0.5)/10)*10); } if CodeCategory == 2 then{ value11 = int(CurrentContracts*0.5); value12 = int(CurrentContracts*0.5); } exitlong("손절",AtStop,EntryPrice*0.70); if MaxEntries == 1 Then{ ExitLong("1차1반절",atlimit,EntryPrice*1.1,"",value11,1); ExitLong("1차전부",atlimit,EntryPrice*1.18); } if MaxEntries == 2 Then{ if CurrentContracts == MaxContracts Then ExitLong("2차1반절",atlimit,(EntryPrice*0.92)*1.1,"",value11,1); ExitLong("2차전부" ,atlimit,(EntryPrice*0.92)*1.18); } if MaxEntries == 3 Then{ ExitLong("3차1반절",atlimit,(EntryPrice*0.82)*1.1,"",value11,1); ExitLong("3차전부",atlimit,(EntryPrice*0.82)*1.18); if CurrentContracts < MaxContracts and highest(H,BarsSinceEntry) >= (EntryPrice*0.82)*1.1 Then exitlong("3차2익절",AtStop,(EntryPrice*0.82)*1.07); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-05-19 17:44:48

안녕하세요 예스스탁입니다. 당일 청산이 있으면 더이상 진입이 나오지 않게 수정했습니다 input : p1(30), capital(10000000); var : cnt(0),count(0),Xcount(0),sumv(0),mav(0); Condition1 = date==exitdate(1) And MarketPosition(1) == 1; Condition2 = ExitDate(1) == sdate; count = 0; Xcount = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) Then count = count+1; if sdate == ExitDate(cnt) Then Xcount = Xcount+1; } if CodeCategory == 1 Then{ value1 = int(int((capital*0.1)/C)/10)*10; value2 = int(int((capital*0.3)/C)/10)*10; value3 = int(int((capital*0.6)/C)/10)*10; } if CodeCategory == 2 Then{ value1 = int((capital*0.1)/C); value2 = int((capital*0.3)/C); value3 = int((capital*0.6)/C); } sumV = 0; for count = 1 to p1-1 { sumV = sumV+DayClose(count); } maV = (sumV+dayopen()) / p1; if condition1 == false and Condition2 == false Then{ if MarketPosition == 0 and H <= maV*1.02 and L >= maV*0.98 Then buy("1매수",OnClose,def,value1); if MarketPosition == 1 Then{ buy("2매수",atlimit,EntryPrice*0.92,value2); buy("3매수",atlimit,EntryPrice*0.82,value3); } } if MarketPosition == 1 Then{ if CodeCategory == 1 Then{ value11 = int(int((CurrentContracts*0.5)/10)*10); value12 = int(int((CurrentContracts*0.5)/10)*10); } if CodeCategory == 2 then{ value11 = int(CurrentContracts*0.5); value12 = int(CurrentContracts*0.5); } exitlong("손절",AtStop,EntryPrice*0.70); if MaxEntries == 1 Then{ ExitLong("1차1반절",atlimit,EntryPrice*1.1,"",value11,1); ExitLong("1차전부",atlimit,EntryPrice*1.18); } if MaxEntries == 2 Then{ if CurrentContracts == MaxContracts Then ExitLong("2차1반절",atlimit,(EntryPrice*0.92)*1.1,"",value11,1); ExitLong("2차전부" ,atlimit,(EntryPrice*0.92)*1.18); } if MaxEntries == 3 Then{ ExitLong("3차1반절",atlimit,(EntryPrice*0.82)*1.1,"",value11,1); ExitLong("3차전부",atlimit,(EntryPrice*0.82)*1.18); if CurrentContracts < MaxContracts and highest(H,BarsSinceEntry) >= (EntryPrice*0.82)*1.1 Then exitlong("3차2익절",AtStop,(EntryPrice*0.82)*1.07); } } 즐거운 하루되세요 > 부자청년28 님이 쓴 글입니다. > 제목 : 질문드립니다. > 일봉 30일선을 기준으로 하고 분봉에다가 적용시키는시스템 식입니다. 아래식에서 3차매수후에 주가가 올라서 매도가 되자마자 그다음봉에서 재매수가 일어나는데요. 당일 매도가 일어나면 당일 재매수가 안일어나게 하고 싶습니다. input : p1(30), capital(10000000); var : cnt(0),count(0),Xcount(0),sumv(0),mav(0); Condition1 = date==exitdate(1) And MarketPosition(1) == 1; count = 0; Xcount = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) Then count = count+1; if sdate == ExitDate(cnt) Then Xcount = Xcount+1; } if CodeCategory == 1 Then{ value1 = int(int((capital*0.1)/C)/10)*10; value2 = int(int((capital*0.3)/C)/10)*10; value3 = int(int((capital*0.6)/C)/10)*10; } if CodeCategory == 2 Then{ value1 = int((capital*0.1)/C); value2 = int((capital*0.3)/C); value3 = int((capital*0.6)/C); } sumV = 0; for count = 1 to p1-1 { sumV = sumV+DayClose(count); } maV = (sumV+dayopen()) / p1; if condition1 == false Then{ if MarketPosition == 0 and H <= maV*1.02 and L >= maV*0.98 Then buy("1매수",OnClose,def,value1); if MarketPosition == 1 Then{ buy("2매수",atlimit,EntryPrice*0.92,value2); buy("3매수",atlimit,EntryPrice*0.82,value3); } } if MarketPosition == 1 Then{ if CodeCategory == 1 Then{ value11 = int(int((CurrentContracts*0.5)/10)*10); value12 = int(int((CurrentContracts*0.5)/10)*10); } if CodeCategory == 2 then{ value11 = int(CurrentContracts*0.5); value12 = int(CurrentContracts*0.5); } exitlong("손절",AtStop,EntryPrice*0.70); if MaxEntries == 1 Then{ ExitLong("1차1반절",atlimit,EntryPrice*1.1,"",value11,1); ExitLong("1차전부",atlimit,EntryPrice*1.18); } if MaxEntries == 2 Then{ if CurrentContracts == MaxContracts Then ExitLong("2차1반절",atlimit,(EntryPrice*0.92)*1.1,"",value11,1); ExitLong("2차전부" ,atlimit,(EntryPrice*0.92)*1.18); } if MaxEntries == 3 Then{ ExitLong("3차1반절",atlimit,(EntryPrice*0.82)*1.1,"",value11,1); ExitLong("3차전부",atlimit,(EntryPrice*0.82)*1.18); if CurrentContracts < MaxContracts and highest(H,BarsSinceEntry) >= (EntryPrice*0.82)*1.1 Then exitlong("3차2익절",AtStop,(EntryPrice*0.82)*1.07); } }