커뮤니티

수식 검토 부탁드립니다.

프로필 이미지
비정성시
2025-11-10 16:44:50
53
글번호 227854
답변완료

항상 많은 도움 감사드립니다. 시스템식 중에서 포지션 정리 부분에서 stoploss가 생각하고는 다르게 작동하는 경우가 있어서 잘못된 부분에 대해서 검토 부탁드립니다.
if MarketPosition == 1 Then { if IsEntryName("A매수") == true Then SetStopLoss(8,PointStop); if IsEntryName("B매수") == true Then SetStopLoss(10,PointStop); if IsEntryName("C매수") == true Then SetStopLoss(15,PointStop); } Else SetStopLoss(0);
if MarketPosition == 1 Then { if IsEntryName("A매수") == true Then { if CrossDown(A,B) then Exitlong("매수정리1",atmarket,def,"A매수"); }
if IsEntryName("B매수") == true Then { if CrossDown(C,D) then Exitlong("매수정리2",atmarket,def,"B매수"); }
if IsEntryName("C매수") == true Then { if CrossDown(E,F) then Exitlong("매수정리3",atmarket,def,"C매수"); }
}
if MarketPosition == -1 Then { if IsEntryName("AI매도") == true Then SetStopLoss(8,PointStop); if IsEntryName("B매도") == true Then SetStopLoss(10,PointStop); if IsEntryName("C매도") == true Then SetStopLoss(15,PointStop); } Else SetStopLoss(0);
if MarketPosition ==- 1 Then { if IsEntryName("A매도") == true Then { if CrossUp(A,B) then Exitshort("매도정리1",atmarket,def,"A매도"); }
if IsEntryName("B매도") == true Then { if CrossUp(C,D) then Exitshort("매도정리2",atmarket,def,"B매도"); }
if IsEntryName("C매도") == true Then { if CrossUp(E,F) then Exitshort("매도정리3",atmarket,def,"C매도"); }
}
이런식으로 작성하면 매수쪽에 stoploss 값은 맞게 포지션 정리가 되는데 매도쪽 stoploss가 정해놓은것과 다른 값에 정리가 되는 경우가 있어서요..검토 및 수식 수정 부탁드리겠습니다. 핵심은 매수와 매도 포지션 정리할때 각각 종류의 매수,매도 포지션에 다른 stoploss값을 주려는 것입니다.

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-11-11 13:02:09

안녕하세요 예스스탁입니다. if MarketPosition == 1 Then { if IsEntryName("A매수") == true Then SetStopLoss(8,PointStop); if IsEntryName("B매수") == true Then SetStopLoss(10,PointStop); if IsEntryName("C매수") == true Then SetStopLoss(15,PointStop); } else if MarketPosition == -1 Then { if IsEntryName("AI매도") == true Then SetStopLoss(8,PointStop); if IsEntryName("B매도") == true Then SetStopLoss(10,PointStop); if IsEntryName("C매도") == true Then SetStopLoss(15,PointStop); } Else SetStopLoss(0); 강제청산을 위와 같이 처리해 주셔야 합니다. 따로 else가 붙어 있으면 반대포지션시 계속 해제가 됩니다. 즐거운 하루되세요