커뮤니티
청산식 요청드립니다
2017-05-10 17:07:12
125
글번호 109439
분할 진입후,
분할 청산식을 만드려고합니다.
예를 들어 A포인트에서 1계약 진입되었을경우
A1조건에서 익절 및 X틱 손절. (첫번째 익절 식)
익절 조건 또는 손절 조건 만족전에 , 다시 진입조건이 완료되었을경우, 1계약 추가진입.
현재 계약수가 2계약일 경우, 1계약은 A1조건에서 익절, 1계약은 A2조건에서 익절
손절은 두계약수의 평균 단가에서 X틱 손절. (두번쨰 익절 식)
답변 1
예스스탁 예스스탁 답변
2017-05-11 10:56:35
안녕하세요
예스스탁입니다.
아래 내용 참고하시기 바랍니다.
input : X(10);
var : Bxcond1(false),Bxcond2(false);
var : Sxcond1(false),Sxcond2(false);
if MarketPosition == 1 Then{
exitlong("BL",AtStop,AvgEntryPrice-X*PriceScale);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bx2" Then
Bxcond2 = true;
if MaxEntries >= 1 and Bxcond1 == false and A1조건 Then
ExitLong("bx1",OnClose,def,"",1,1);
if MaxEntries >= 2 and Bxcond2 == false and A2조건 Then
ExitLong("bx2",OnClose,def,"",1,1);
}
Else{
Bxcond1 = false;
Bxcond2 = false;
}
if MarketPosition == -1 Then{
ExitShort("SL",AtStop,AvgEntryPrice+X*PriceScale);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "sx1" Then
Sxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "sx2" Then
Sxcond2 = true;
if MaxEntries >= 1 and Sxcond1 == false and A1조건 Then
ExitShort("sx1",OnClose,def,"",1,1);
if MaxEntries >= 2 and Sxcond2 == false and A2조건 Then
ExitShort("sx2",OnClose,def,"",1,1);
}
Else{
Sxcond1 = false;
Sxcond2 = false;
}
즐거운 하루되세요
> 이대규 님이 쓴 글입니다.
> 제목 : 청산식 요청드립니다
> 분할 진입후,
분할 청산식을 만드려고합니다.
예를 들어 A포인트에서 1계약 진입되었을경우
A1조건에서 익절 및 X틱 손절. (첫번째 익절 식)
익절 조건 또는 손절 조건 만족전에 , 다시 진입조건이 완료되었을경우, 1계약 추가진입.
현재 계약수가 2계약일 경우, 1계약은 A1조건에서 익절, 1계약은 A2조건에서 익절
손절은 두계약수의 평균 단가에서 X틱 손절. (두번쨰 익절 식)
다음글
이전글