커뮤니티
질문드립니다.
2018-07-06 11:10:15
163
글번호 120313
1
아래 시스템은 다음 봉 시가가 5%이상일 경우와 아닌 경우 분할 매매 시스템식입니다.
if MarketPosition == 1 Then
{
#봉완성시 다음봉 시가가 진입가 대비 5% 이상 상승하면 true
if NextBarOpen >= EntryPrice*(1+Per/100) Then
OpenCond = true;
#BP1 청산이 발생하면 Xcond1은 true
if LatestExitName(0) == "BP1" Then
Xcond1 = true;
#BP2 청산이 발생하면 Xcond2은 true
if LatestExitName(0) == "BP2" Then
Xcond2 = true;
#BP3 청산이 발생하면 Xcond3은 true
if LatestExitName(0) == "BP3" Then
Xcond3 = True;
#OpenCond가 false일때
if OpenCond == false Then
{
if Xcond1 == false then
ExitLong("BP1",atlimit,EntryPrice(0)*1.03,"",Floor(MaxContracts*0.3),1);
if Xcond2 == false then
ExitLong("BP2",atlimit,EntryPrice(0)*1.04,"",Floor(MaxContracts*0.4),1);
if Xcond3 == false then
ExitLong("BP3",atlimit,EntryPrice(0)*1.05);
}
#OpenCond가 true일떄
if OpenCond == true Then
{
#BP1로 청산이 안된 경우만 발생
if Xcond1 == false Then
ExitLong("BP6",atlimit,EntryPrice*(1+(Per+3)/100),"",Floor(MaxContracts*0.3),1);
#BP2로 청산이 안된 경우만 발생
if Xcond2 == false Then
ExitLong("BP7",atlimit,EntryPrice*(1+(Per+4)/100),"",Floor(MaxContracts*0.4),1);
#BP3로 청산이 안된 경우만 발생
if Xcond3 == false Then
ExitLong("BP8",atlimit,EntryPrice*(1+(Per+5)/100));
#5%이하로 가격하락하면 전량처산
exitlong("BP5",AtStop,EntryPrice*(1+Per/100));
}
}
#매수포지션이 아니면 모두 false로 초기화
if MarketPosition != 1 Then{
OpenCond = false;
Xcond1 = false;
Xcond2 = false;
Xcond3 = false;
}
다음 봉 시가가 5%이상일때 트레일링 스탑을 적용하고 5%미만으로 상승폭이 떨어질때 전량청산으로 수정하려면 Opencond이 true인 부분만 아래와 같이 수정할 경우 사용가능한지 문의드립니다
#OpenCond가 true일떄
if OpenCond == true Then
{
SetStopTrailing(2,5,PercentStop,1);
#5%이하로 가격하락하면 전량처산
exitlong("BP5",AtStop,EntryPrice*(1+Per/100));
}
2
SetStopTrailing은 분할로 사용이 불가하죠?
3
분봉상 큰폭으로 상승할때 수익극대화할수 있는 방법에 SetStopTrailing말고 다른 함수가 있는지도 문의드립니다.(분할로 매매가 가능한)
답변 1
예스스탁 예스스탁 답변
2018-07-06 13:25:28
안녕하세요
예스스탁입니다.
1
해제하는 조건을 넣으셔야 합니다.
강제청산은 한번 셋팅되면 계속 그 설정을 유지합니다.
그러므로 아래와 같이 조건에 만족하지 않으면
해제하는 내용을 같이 추가해 주셔야 합니다.
if OpenCond == true Then
{
SetStopTrailing(2,5,PercentStop,1);
#5%이하로 가격하락하면 전량처산
exitlong("BP5",AtStop,EntryPrice*(1+Per/100));
}
else
SetStopTrailing(0,0);해제
2
강제청산은 하나의 신호의 수량을 분할로 처리할수는 없습니다.
3
SetStopTrailing은 일정수익이후에 수익이 감소하면 청산하는 내용입니다.
분할로 처리하기 위해서는 일반청산함수로 별도로 작성하셔야 합니다.
아래 내용 참고하시기 바랍니다.
var : trXcond1(false),trXcond2(false),trXcond3(false);
if MarketPosition == 1 Then
{
#BP1 청산이 발생하면 Xcond1은 true
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx1" Then
trXcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx2" Then
trXcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "trx3" Then
trXcond3 = true;
var1 = highest(H,BarsSinceEntry);
#5~7%수익이면 최고가에서 2% 하락하면 30% 청산
if trXcond1 == false and var1 >= EntryPrice*5 and var1 < EntryPrice*1.7 Then
ExitLong("trx1",AtStop,var1*0.98,"",Floor(maxContracts*0.3),1);
#7%~10%수익이면 최고가에서 2% 하락하면 30% 청산
if trXcond2 == false and var1 >= EntryPrice*7 and var1 < EntryPrice*1.10 Then
ExitLong("trx2",AtStop,var1*0.98,"",Floor(maxContracts*0.3),1);
#7%~10%수익이면 최고가에서 2% 하락하면 전량 청산
if trXcond3 == false and var1 >= EntryPrice*10 Then
ExitLong("trx3",AtStop,var1*0.98,"",Floor(maxContracts*0.3),1);
}
if MarketPosition != 1 Then
{
trXcond1 = false;
trXcond2 = false;
trXcond3 = false;
}
즐거운 하루되세요
> 가이츠 님이 쓴 글입니다.
> 제목 : 질문드립니다.
> 1
아래 시스템은 다음 봉 시가가 5%이상일 경우와 아닌 경우 분할 매매 시스템식입니다.
if MarketPosition == 1 Then
{
#봉완성시 다음봉 시가가 진입가 대비 5% 이상 상승하면 true
if NextBarOpen >= EntryPrice*(1+Per/100) Then
OpenCond = true;
#BP1 청산이 발생하면 Xcond1은 true
if LatestExitName(0) == "BP1" Then
Xcond1 = true;
#BP2 청산이 발생하면 Xcond2은 true
if LatestExitName(0) == "BP2" Then
Xcond2 = true;
#BP3 청산이 발생하면 Xcond3은 true
if LatestExitName(0) == "BP3" Then
Xcond3 = True;
#OpenCond가 false일때
if OpenCond == false Then
{
if Xcond1 == false then
ExitLong("BP1",atlimit,EntryPrice(0)*1.03,"",Floor(MaxContracts*0.3),1);
if Xcond2 == false then
ExitLong("BP2",atlimit,EntryPrice(0)*1.04,"",Floor(MaxContracts*0.4),1);
if Xcond3 == false then
ExitLong("BP3",atlimit,EntryPrice(0)*1.05);
}
#OpenCond가 true일떄
if OpenCond == true Then
{
#BP1로 청산이 안된 경우만 발생
if Xcond1 == false Then
ExitLong("BP6",atlimit,EntryPrice*(1+(Per+3)/100),"",Floor(MaxContracts*0.3),1);
#BP2로 청산이 안된 경우만 발생
if Xcond2 == false Then
ExitLong("BP7",atlimit,EntryPrice*(1+(Per+4)/100),"",Floor(MaxContracts*0.4),1);
#BP3로 청산이 안된 경우만 발생
if Xcond3 == false Then
ExitLong("BP8",atlimit,EntryPrice*(1+(Per+5)/100));
#5%이하로 가격하락하면 전량처산
exitlong("BP5",AtStop,EntryPrice*(1+Per/100));
}
}
#매수포지션이 아니면 모두 false로 초기화
if MarketPosition != 1 Then{
OpenCond = false;
Xcond1 = false;
Xcond2 = false;
Xcond3 = false;
}
다음 봉 시가가 5%이상일때 트레일링 스탑을 적용하고 5%미만으로 상승폭이 떨어질때 전량청산으로 수정하려면 Opencond이 true인 부분만 아래와 같이 수정할 경우 사용가능한지 문의드립니다
#OpenCond가 true일떄
if OpenCond == true Then
{
SetStopTrailing(2,5,PercentStop,1);
#5%이하로 가격하락하면 전량처산
exitlong("BP5",AtStop,EntryPrice*(1+Per/100));
}
2
SetStopTrailing은 분할로 사용이 불가하죠?
3
분봉상 큰폭으로 상승할때 수익극대화할수 있는 방법에 SetStopTrailing말고 다른 함수가 있는지도 문의드립니다.(분할로 매매가 가능한)
다음글
이전글