커뮤니티

문의 드립니다.

프로필 이미지
부우자되고싶다
2018-11-09 00:09:03
159
글번호 123481
답변완료
gap fill run 전략식을 간단히 만들어 봤는데 익절을 넣고 싶습니다. 어떻게 해야 하나요? 1포인트가 진입가격에서 오르면 익절하고 싶은데 어떻게 해야할지 답답합니다 Input : GapUp(0.5), GapDN(0.5), losslimit(1), earnlimit1(1.5), earnlimit2(1.5); If sDate != sDate[1] Then{ if O > C[1]*(1+GapUp/100) Then { If C >= O Then Buy("Gap-run-buy", AtStop, C); Else Sell("Gap-fill-sell", AtStop, C); } if O < C[1]*(1-GapDN/100) Then { If C >= O Then Buy("Gapfill-buy", AtStop, C); Else Sell("Gaprun-sell", AtStop, C); } } setstoploss(losslimit,PointStop); if marketposition = 1 Then{ exitlong("매수 이익",atlimit,entryPrice+earnlimit1) } if marketposition = -1 Then{ exitlong("매도 이익",atlimit,entryPrice-earnlimit2) } SetStopEndofday(); 마켓포지션 부분부터 오류가 나는데 해결방법좀 주세요
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-11-09 14:05:00

안녕하세요 예스스탁입니다. 별도로 추가해 드릴부분이 없습니다. 현재 수식에 익절 내용이 있습니다. if marketposition = 1 Then{ exitlong("매수 이익",atlimit,entryPrice+earnlimit1) } if marketposition = -1 Then{ exitlong("매도 이익",atlimit,entryPrice-earnlimit2) } 매수는 진입가 대비 earnlimit1만큼 상승하면 청산 매도는 진입가 대비 earnlimit2만큼 하락하면 청산 해당 외부변수 값만 1로 변경해 주시면 되며 수식에 오류나는 부분을 수정해 드립니다. Input : GapUp(0.5), GapDN(0.5), losslimit(1), earnlimit1(1), earnlimit2(1); If sDate != sDate[1] Then { if O > C[1]*(1+GapUp/100) Then { If C >= O Then Buy("Gap-run-buy", AtStop, C); Else Sell("Gap-fill-sell", AtStop, C); } if O < C[1]*(1-GapDN/100) Then { If C >= O Then Buy("Gapfill-buy", AtStop, C); Else Sell("Gaprun-sell", AtStop, C); } } setstoploss(losslimit,PointStop); if marketposition == 1 Then{ exitlong("매수 이익",atlimit,entryPrice+earnlimit1); } if marketposition == -1 Then{ exitlong("매도 이익",atlimit,entryPrice-earnlimit2); } SetStopEndofday(); 즐거운 하루되세요 > 부우자되고싶다 님이 쓴 글입니다. > 제목 : 문의 드립니다. > gap fill run 전략식을 간단히 만들어 봤는데 익절을 넣고 싶습니다. 어떻게 해야 하나요? 1포인트가 진입가격에서 오르면 익절하고 싶은데 어떻게 해야할지 답답합니다 Input : GapUp(0.5), GapDN(0.5), losslimit(1), earnlimit1(1.5), earnlimit2(1.5); If sDate != sDate[1] Then{ if O > C[1]*(1+GapUp/100) Then { If C >= O Then Buy("Gap-run-buy", AtStop, C); Else Sell("Gap-fill-sell", AtStop, C); } if O < C[1]*(1-GapDN/100) Then { If C >= O Then Buy("Gapfill-buy", AtStop, C); Else Sell("Gaprun-sell", AtStop, C); } } setstoploss(losslimit,PointStop); if marketposition = 1 Then{ exitlong("매수 이익",atlimit,entryPrice+earnlimit1) } if marketposition = -1 Then{ exitlong("매도 이익",atlimit,entryPrice-earnlimit2) } SetStopEndofday(); 마켓포지션 부분부터 오류가 나는데 해결방법좀 주세요