커뮤니티

문제점 수정 부탁드립니다.

프로필 이미지
대구어린울프
2020-08-18 01:52:53
857
글번호 141559
답변완료
안녕하세요? 아래의 수식이 현재 익절이 제대로 안나가고있습니다. 손절은 잘되는데 익절폭이 예를들어 1포라고해놓으면 1.2포 1.4포 이런식으로 범위가 다르게 나가고있습니다. 부디 검토부탁드립니다. 감사합니다. Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000); Variable : ent_position(0); if MarketPosition == 0 Then{ var1 = 0; ent_position = 0; } //If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) or ( C[1]<O[1] and H[1]==O[1] and C>O ) Then { If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then { Buy("매수",AtMarket); Var1 = NextBarOpen; ent_position = 1; } //If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) or ( C[1]>O[1] and L[1]==O[1] and C<O ) Then { If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then { Sell("매도",AtMarket); Var1 = NextBarOpen; ent_position = -1; } if PositionProfit >= profit_pt and ent_position<>0 Then{ if ent_position == 1 and C<O Then { ExitLong("매수청산"); } if ent_position == -1 and C>O Then { ExitLong("매도청산"); } } SetStopLoss(loss_pt,PointStop); SetStopEndofday(장종료청산);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-08-20 15:12:58

안녕하세요 예스스탁입니다. 1 작성하신 매수청산과 매도청산식은 지정한 속익이상이고 양봉이나 음봉이면 봉 종가에 청산하는 내용입니다. 종가기준으로 수익이 기준이상 발생하므로 정확히 지정한 포인트가 아닐수 있습니다. 2 작성하신 수식중 매도청산은 이름은 매도청산이지만 함수가 exitlong입니다. 매도포지션 청산함수는 exitshort입니다. 3 지정한 수익달성시 즉시 청산을 원하시면 손절매와 같이 강제청산함수를 사용하셔야 합니다. Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000); Variable : ent_position(0); if MarketPosition == 0 Then { var1 = 0; ent_position = 0; } If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then { Buy("매수",AtMarket); Var1 = NextBarOpen; ent_position = 1; } If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then { Sell("매도",AtMarket); Var1 = NextBarOpen; ent_position = -1; } SetStopProfittarget(profit_pt,PointStop); SetStopLoss(loss_pt,PointStop); SetStopEndofday(장종료청산); 즐거운 하루되세요 > 대구어린울프 님이 쓴 글입니다. > 제목 : 문제점 수정 부탁드립니다. > 안녕하세요? 아래의 수식이 현재 익절이 제대로 안나가고있습니다. 손절은 잘되는데 익절폭이 예를들어 1포라고해놓으면 1.2포 1.4포 이런식으로 범위가 다르게 나가고있습니다. 부디 검토부탁드립니다. 감사합니다. Input : 단기(5), 장기(20), profit_pt(0.5), loss_pt(0.5), 장종료청산(151000); Variable : ent_position(0); if MarketPosition == 0 Then{ var1 = 0; ent_position = 0; } //If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) or ( C[1]<O[1] and H[1]==O[1] and C>O ) Then { If ma(C,단기)>ma(C,장기) and ( C>O and L==O ) and ent_position == 0 Then { Buy("매수",AtMarket); Var1 = NextBarOpen; ent_position = 1; } //If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) or ( C[1]>O[1] and L[1]==O[1] and C<O ) Then { If ma(C,단기)<ma(C,장기) and ( C<O and H==O ) and ent_position == 0 Then { Sell("매도",AtMarket); Var1 = NextBarOpen; ent_position = -1; } if PositionProfit >= profit_pt and ent_position<>0 Then{ if ent_position == 1 and C<O Then { ExitLong("매수청산"); } if ent_position == -1 and C>O Then { ExitLong("매도청산"); } } SetStopLoss(loss_pt,PointStop); SetStopEndofday(장종료청산);