커뮤니티

재문의

프로필 이미지
오이도인
2008-12-06 16:39:35
953
글번호 18597
답변완료
일전에 문의한 내용의 아래 답신에서.. 진입은 의도대로 이나.. 청산[손절/익절]이..BA,BB 동시에 처리가 되는군요.. 지금은 잔고가 BA와 BB가 같이 있는 경우.. BB손절,BB익절로 동시에 동일한 값에 다 청산되네요.. 익절이나 손절이나..각각 BA,BB 지정한 값에 별도로 나오게 하려면 어떻게 해야 하는요? 즉,BA,BB 진입후 하락하게 되면 BB 먼저 지정된 값에 도달하면 BB만 손절 나오고.. BA는 BA에 지정한 값에 도달할 만큼 더 하락한 뒤에 별도로 손절 나오게 하고 싶거든요.. 익절도 마찬가지 방식으로요..부탁합니다. ############################################# var: count(0),cnt(0),entryB(0); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } if MarketPosition() == 0 and C> O and count < 3 and stime < 150000 Then{ buy("BA"); entryB = C; } if MarketPosition() == 1 and CurrentEntries() == 1 and stime < 150000 Then{ if C > EntryPrice()+1 Then{ buy("BB"); entryB = C; } } ## BA매수만 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 1 Then{ exitlong("BA손절",AtStop,entryB-1.2); if highest(C,BarsSinceEntry) >= DayOpen()+1.6 Then exitlong("BA익절",AtStop,highest(C,BarsSinceEntry)-0.6); } ## BA와 BB 2개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 2 Then{ exitlong("BB손절",AtStop,entryB-1.3); if highest(C,BarsSinceEntry) >= entryB+1.5 Then exitlong("BB익절",AtStop,highest(H,BarsSinceEntry)-0.4); } SetStopEndofday(1500);
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2008-12-08 15:53:47

안녕하세요 예스스탁입니다. 진입시 1계약씩 진입하는 것으로 작성했습니다. var: count(0),cnt(0),entryB(0); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } if MarketPosition() == 0 and C> O and count < 3 and stime < 150000 Then{ buy("BA"); entryB = C; } if MarketPosition() == 1 and CurrentEntries() == 1 and stime < 150000 and accumn(iff(CurrentEntries == 2,1,0),BarsSinceEntry()+1) < 1 Then{ if C > EntryPrice()+1 Then{ buy("BB"); entryB = C; } } ## BA매수만 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 1 Then{ exitlong("BA손절",AtStop,entryB-1.2,"",1,1); if highest(C,BarsSinceEntry) >= DayOpen()+1.6 Then exitlong("BA익절",AtStop,highest(C,BarsSinceEntry)-0.6,"",1,1); } ## BA와 BB 2개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 2 Then{ exitlong("BB손절",AtStop,entryB-1.3,"",1,1); if highest(C,BarsSinceEntry) >= entryB+1.5 Then exitlong("BB익절",AtStop,highest(H,BarsSinceEntry)-0.4,"",1,1); } SetStopEndofday(1500); 즐거운 하루되세요 > 오이도인 님이 쓴 글입니다. > 제목 : 재문의 > 일전에 문의한 내용의 아래 답신에서.. 진입은 의도대로 이나.. 청산[손절/익절]이..BA,BB 동시에 처리가 되는군요.. 지금은 잔고가 BA와 BB가 같이 있는 경우.. BB손절,BB익절로 동시에 동일한 값에 다 청산되네요.. 익절이나 손절이나..각각 BA,BB 지정한 값에 별도로 나오게 하려면 어떻게 해야 하는요? 즉,BA,BB 진입후 하락하게 되면 BB 먼저 지정된 값에 도달하면 BB만 손절 나오고.. BA는 BA에 지정한 값에 도달할 만큼 더 하락한 뒤에 별도로 손절 나오게 하고 싶거든요.. 익절도 마찬가지 방식으로요..부탁합니다. ############################################# var: count(0),cnt(0),entryB(0); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } if MarketPosition() == 0 and C> O and count < 3 and stime < 150000 Then{ buy("BA"); entryB = C; } if MarketPosition() == 1 and CurrentEntries() == 1 and stime < 150000 Then{ if C > EntryPrice()+1 Then{ buy("BB"); entryB = C; } } ## BA매수만 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 1 Then{ exitlong("BA손절",AtStop,entryB-1.2); if highest(C,BarsSinceEntry) >= DayOpen()+1.6 Then exitlong("BA익절",AtStop,highest(C,BarsSinceEntry)-0.6); } ## BA와 BB 2개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 2 Then{ exitlong("BB손절",AtStop,entryB-1.3); if highest(C,BarsSinceEntry) >= entryB+1.5 Then exitlong("BB익절",AtStop,highest(H,BarsSinceEntry)-0.4); } SetStopEndofday(1500);
프로필 이미지

오이도인

2008-12-08 19:15:15

빠른 답변 감사합니다.. 1] 조금 내용을 수정하여 시가 위 일정 범위 돌파시마다 진입하여 진입수량 4개까지 피라미딩 가능한 식으로 아래와 같이 만들어봤는데.. [나중엔 최대 10개까지로 하려고 생각중입니다] 조금 이상합니다..원하는대로 들어가기도 하고 안들어가기도 하고 그러네요.. 수정 부탁드립니다... 2] 일최대진입수량은 11개로 제한하여면 어떤 구문을 추가해야하나요..? 아래 "일최대진입횟수"가 진입 수량을 제한하는게 아니라..피라미딩 횟수를 나타내는 것 같네요.. 3] 또,손절이나 익절의 경우 Isentryname("ba") 처럼 지정하여.. 진입명이 ba 인 진입만 처리할수는 없는건가요? if isentryname("ba") then exitlong("baCS",AtStop,entryBA-1,"",1,1); 이런 식으론 안되는건지요? 수고하세요.. ########################################################################## var: countN(0),cntN(0); vars : entryBA(0),entryBB(0),entryBC(0),entryBD(0); input : 일최대진입횟수(5); input : entrystime(090000),entryftimeB(143000) ; input : pyramidgap(0.5) ; countN = 0; for cntN = 0 to 10 { if sdate == EntryDate(cntN) Then countN = countN+1; } ## BA if stime>entrystime and stime < entryftimeB Then if MarketPosition() == 0 and C> dayOpen() and countN <일최대진입횟수 Then { if crossup(C,dayopen()+pyramidgap) Then{ //pyramidgap 돌파시 buy("ba"); entryBA = C; //ba의 진입가 } } ## BB if stime>entrystime and stime < entryftimeB Then if MarketPosition() == 1 and CurrentEntries() == 1 and countN <일최대진입횟수-1 and accumn(iff(CurrentEntries == 2,1,0),BarsSinceEntry()+1) < 1 Then { if crossup(C,dayopen()+pyramidgap*2) Then{ //pyramidgap 돌파시 buy("bb"); entryBB = C; //bb의 진입가 } } ## BC if stime>entrystime and stime < entryftimeB Then if MarketPosition() == 1 and CurrentEntries() == 2 and countN <일최대진입횟수-2 and accumn(iff(CurrentEntries == 3,1,0),BarsSinceEntry()+1) < 2 Then { if crossup(C,dayopen()+pyramidgap*3) Then{ //pyramidgap 돌파시 buy("bc"); entryBC = C; //bc의 진입가 } } ## BD if stime>entrystime and stime < entryftimeB Then if MarketPosition() == 1 and CurrentEntries() == 3 and countN <일최대진입횟수-3 and accumn(iff(CurrentEntries == 4,1,0),BarsSinceEntry()+1) < 3 Then { if crossup(C,dayopen()+pyramidgap*3) Then{ //pyramidgap 돌파시 buy("bd"); entryBD = C; //bd의 진입가 } } ########################################################################## input : CSlen(1.5),TSplen(1.9),returnTSlen(0.8) ; ## BA매수만 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 1 then { exitlong("baCS",AtStop,entryBA-CSlen,"",1,1); if highest(C,BarsSinceEntry) >= entryBA+TSplen Then exitlong("baTS",AtStop,highest(C,BarsSinceEntry)-returnTSlen,"",1,1); } ## BA와 BB 2개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() == 2 then { exitlong("bbCS",AtStop,entryBB-CSlen,"",1,1); if highest(C,BarsSinceEntry) >= entryBB+TSplen Then exitlong("bbTS",AtStop,highest(H,BarsSinceEntry)-returnTSlen,"",1,1); } ## BA,BB & BC 3개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() >= 3 then { exitlong("bcCS",AtStop,entryBC-CSlen,"",1,1); if highest(C,BarsSinceEntry) >= entryBC+TSplen Then exitlong("bcTS",AtStop,highest(H,BarsSinceEntry)-returnTSlen,"",1,1); } ## BA,BB,BC & BD 4개 진입이 피라미딩으로 진입했을 경우 if MarketPosition() == 1 and CurrentEntries() >= 4 then { exitlong("bdCS",AtStop,entryBD-CSlen,"",1,1); if highest(C,BarsSinceEntry) >= entryBD+TSplen Then exitlong("bdTS",AtStop,highest(H,BarsSinceEntry)-returnTSlen,"",1,1); } SetStopEndofday(1500);