커뮤니티

손절관련

프로필 이미지
toal
2017-04-28 12:51:18
105
글번호 109254
답변완료
시간에 따라 손절틱수를 변경할수있도록 문의 드렸는데 아래와 같이 답변 주셨습니다. 근데 그럼 예를들어 아래 수식에 추가적으로 19시에 모두 청산하는 수식을 넣을수 있나요? 손절조건은 아래 조건대로 적용되면서 정해진 시간되면 모두 청산 하게끔요. 만약에 가능하다면 혹시 아래 손절 틱수를 변수로 빼서 조절할수 있게 작성할수 있을까요? if MarketPosition == 1 Then{ if stime < 150000 Then exitlong("bx1",AtStop,EntryPrice-PriceScale*12); else exitlong("bx2",AtStop,EntryPrice-PriceScale*7); } if MarketPosition == -1 Then{ if stime < 150000 Then ExitShort("sx1",AtStop,EntryPrice+PriceScale*12); else ExitShort("sx2",AtStop,EntryPrice+PriceScale*7); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-04-28 13:57:58

안녕하세요 예스스탁입니다. 아래 식구조 참고하시기 바랍니다. input : 손절틱수1(12),손절틱수2(7); var : Tcond(false); #영업일 변경되면 진입가능하게 Tcond는 true if Bdate != Bdate[1] Then Tcond = true; #19시가 되면 더이상 진입못하게 Tcond는 false로 만들고 #보유 포지션있으면 청산 if stime == 190000 or (stime > 190000 and stime[1] < 1900000) Then{ Tcond = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } #Tcond가 true일때만 진입 if Tcond == true then{ if 매수진입조건 Then buy(); if 매도진입조건 Then sell(); } if MarketPosition == 1 Then{ if stime < 150000 Then exitlong("bx1",AtStop,EntryPrice-PriceScale*손절틱수1); else exitlong("bx2",AtStop,EntryPrice-PriceScale*손절틱수2); } if MarketPosition == -1 Then{ if stime < 150000 Then ExitShort("sx1",AtStop,EntryPrice+PriceScale*손절틱수1); else ExitShort("sx2",AtStop,EntryPrice+PriceScale*손절틱수2); } 즐거운 하루되세요 > toal 님이 쓴 글입니다. > 제목 : 손절관련 > 시간에 따라 손절틱수를 변경할수있도록 문의 드렸는데 아래와 같이 답변 주셨습니다. 근데 그럼 예를들어 아래 수식에 추가적으로 19시에 모두 청산하는 수식을 넣을수 있나요? 손절조건은 아래 조건대로 적용되면서 정해진 시간되면 모두 청산 하게끔요. 만약에 가능하다면 혹시 아래 손절 틱수를 변수로 빼서 조절할수 있게 작성할수 있을까요? if MarketPosition == 1 Then{ if stime < 150000 Then exitlong("bx1",AtStop,EntryPrice-PriceScale*12); else exitlong("bx2",AtStop,EntryPrice-PriceScale*7); } if MarketPosition == -1 Then{ if stime < 150000 Then ExitShort("sx1",AtStop,EntryPrice+PriceScale*12); else ExitShort("sx2",AtStop,EntryPrice+PriceScale*7); }