예스스탁
예스스탁 답변
2023-12-06 13:56:34
안녕하세요
예스스탁입니다.
if MarketPosition == 1 Then
{
}
else if MarketPosition == -1 Then
{
}
else
{
}
위 구조가 되어야 하며 진입명칭에 알파벳이 사용되면
대소문자 모두 동일하게 지정하셔야 합니다.
if MarketPosition == 1 Then
{
if IsEntryName("A매수") == true Then
{
ExitLong("Sp1",AtLimit,EntryPrice+20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
ExitLong("A매수정리",atmarket,def,"A매수");
}
if IsEntryName("B매수") == true Then
{
ExitLong("Sp2",AtLimit,EntryPrice+10,"",1,1);
SetStopLoss(10,PointStop);
if A-1 Then
ExitLong("B매수정리",atmarket,def,"B매수");
}
}
Else if MarketPosition == -1 Then
{
if IsEntryName("A매도") == true Then
{
Exitshort("Bp1",AtLimit,EntryPrice-20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
Exitshort("A매도정리",atmarket,def,"A매도");
}
if IsEntryName("B매도") == true Then
{
Exitshort("Bp2",AtLimit,EntryPrice-10,"",1,1);
SetStopLoss(10,PointStop);
if B-1 Then
ExitLong("B매도정리",atmarket,def,"B매도");
}
}
Else
SetStopLoss(0);
즐거운 하루되세요
> 비정성시 님이 쓴 글입니다.
> 제목 : 손절식 수정 문의 드립니다.
> 항상 많은 도움 감사드립니다. 아래와 같이 시스템 식을 작성하였는데 생각대로 작동하지 않는 부분이 있어서 수정 문의 드립니다.
Q&A 관리자 분의 도움으로 아래와 같이 작성을 하였는데요..
MarketPosition == -1 매도 포지션 일때는 stoploss가 제대로 작동하는데
MarketPosition == 1 매수 포지션 일때 stoploss 가 작동을 하지 않습니다.
어떤 부분을 수정해야 하나요? 혹은 다른 시스템식으로 작성을 하여야 하나요?
매도,매수 모두 분할청산 및 청산은 문제없이 작동합니다.
///////////////////////////////////////////////////////////////
if MarketPosition == 1 Then
{
if IsEntryName("A매수") == true Then
{
ExitLong("Sp1",AtLimit,EntryPrice+20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
ExitLong("A매수정리",atmarket,def,"A매수");
}
if IsEntryName("b매수") == true Then
{
ExitLong("Sp2",AtLimit,EntryPrice+10,"",1,1);
SetStopLoss(10,PointStop);
if A-1 Then
ExitLong("B매수정리",atmarket,def,"B매수");
}
}
Else
SetStopLoss(0);
////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 Then
{
if IsEntryName("A매도") == true Then
{
Exitshort("Bp1",AtLimit,EntryPrice-20,"",1,1);
SetStopLoss(20,PointStop);
if A-1 Then
Exitshort("A매도정리",atmarket,def,"A매도");
}
if IsEntryName("b매도") == true Then
{
Exitshort("Bp2",AtLimit,EntryPrice-10,"",1,1);
SetStopLoss(10,PointStop);
if B-1 Then
ExitLong("B매도정리",atmarket,def,"B매도");
}
}
Else
SetStopLoss(0);