커뮤니티

스탑로스나 청산시에 반대방향으로의 매매에 관하여...

프로필 이미지
회원
2004-07-26 16:48:16
1107
글번호 4636
답변완료
시스템식에서 청산이나 스탑로스시에 즉시 반대방향으로 매매를 하고 싶어서 다음과 같은 시스템식을 작성하였습니다. 물론, 매매횟수도 2번 이내로 제한하기 위해 반대방향 매매가 이루어질시에는 그 매매가 마지막 매매가 되도록 제한하였습니다. var : cnt(0), th(0), tl(0); th=timehigh(090000, 095959); tl=timelow(090000, 095959); if date != date[1] then cnt = 0; if stime >= 100000 and cnt ==0 then { if CrossUp(C, th) then { cnt = cnt + 1; buy(); setstoploss(1); } if CrossDown(C, tl) then { cnt = cnt + 1; sell(); setstoploss(1); } } # 청산후 반대방향 매매 1회 실시 if cnt==1 and crossup(c, th) then { cnt = cnt + 1; exitshort(); buy(); setstoploss(1); } if cnt==1 and crossdown(c, tl) then { cnt = cnt + 1; exitlong(); sell(); setstoploss(1); } setstopendofday(1450); 위와 같이 했을경우 청산시에 반대방향의 매매가 이루어져야 하는데 그렇게 되지 않더라구요.(뭐가 잘 못 된 것인지?) 그리고 청산시에 반대방향의 매매뿐만 아니라 첫 매매에서의 stoploss 시에도 반대방향의 매매를 할려고 하면 어떻게 해야하는지 알려주시면 감사하겠습니다.^^
기타
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2004-07-28 16:01:28

안녕하세요 예스스탁입니다. 당일청산 함수로 인하여 반대매매가 발생하지 않았습니다. 아래의 식에서 setstoploss와 setstopendofday를 주석처리하시고 적용해 보시기 바랍니다. var : bcnt(0), scnt(0), bbcnt(0), sscnt(0), th(0), tl(0); th=timehigh(090000, 095959); tl=timelow(090000, 095959); if date != date[1] then { bcnt = 0; scnt = 0; bbcnt = 0; sscnt = 0; } setstoploss(1); # 신규진입 if stime >= 100000 and (bcnt ==0 or scnt ==0) then { if CrossUp(C, th) then { bcnt = bcnt + 1; buy("신규매수"); } if bcnt != 1 and CrossDown(C, tl) then { scnt = scnt + 1; sell("신규매도"); } } # 청산 if bcnt==1 and crossdown(c, tl) then exitlong("매수청산"); if scnt==1 and crossup(c, th) then exitshort("매도청산"); # 재진입 (청산후 반대방향 매매 1회 실시) if scnt==1 and crossup(c, th) and bbcnt < 1 then { buy("재매수"); bbcnt = bbcnt + 1; } if bcnt==1 and crossdown(c, tl) and sscnt < 1 then { sell("재매도"); sscnt = sscnt + 1; } setstopendofday(1450); 감사합니다. > HH_kobil1230 님이 쓴 글입니다. > 제목 : 스탑로스나 청산시에 반대방향으로의 매매에 관하여... > 시스템식에서 청산이나 스탑로스시에 즉시 반대방향으로 매매를 하고 싶어서 다음과 같은 시스템식을 작성하였습니다. 물론, 매매횟수도 2번 이내로 제한하기 위해 반대방향 매매가 이루어질시에는 그 매매가 마지막 매매가 되도록 제한하였습니다. var : cnt(0), th(0), tl(0); th=timehigh(090000, 095959); tl=timelow(090000, 095959); if date != date[1] then cnt = 0; if stime >= 100000 and cnt ==0 then { if CrossUp(C, th) then { cnt = cnt + 1; buy(); setstoploss(1); } if CrossDown(C, tl) then { cnt = cnt + 1; sell(); setstoploss(1); } } # 청산후 반대방향 매매 1회 실시 if cnt==1 and crossup(c, th) then { cnt = cnt + 1; exitshort(); buy(); setstoploss(1); } if cnt==1 and crossdown(c, tl) then { cnt = cnt + 1; exitlong(); sell(); setstoploss(1); } setstopendofday(1450); 위와 같이 했을경우 청산시에 반대방향의 매매가 이루어져야 하는데 그렇게 되지 않더라구요.(뭐가 잘 못 된 것인지?) 그리고 청산시에 반대방향의 매매뿐만 아니라 첫 매매에서의 stoploss 시에도 반대방향의 매매를 할려고 하면 어떻게 해야하는지 알려주시면 감사하겠습니다.^^