커뮤니티
청산식 부탁드립니다.
2016-01-05 22:21:36
116
글번호 94093
안녕하세요
아래 청산식(익절,손절)을 분할청산식으로 변경 부탁드립니다.
=> 처음 지정한 틱수로 1계약 청산후(익절,손절) 다음 청산부터는 직전 청산가격에
+ - 틱으로 청산 (한번 청산된 자리에서는 또 청산되지않게함).
익절 = 처음 P1(20틱)에서 1 계약 청산
이후 5 틱씩 수익 발생시마다 1 계약씩 청산.
손절 = 처음 S1(20틱)에서 1 계약 청산
이후 5 틱씩 손실 발생시마다 1 계약씩 청산.
=============================================================================
##청산(익절)
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*P1 Then
exitlong("btr",AtStop,highest(H,BarsSinceEntry)-PriceScale*1);
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*P1 Then
exitshort("str",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*1);
##청산(손절)
if MarketPosition == 1 and c < (var1+var2)/2 and c < var1-pricescale*s1 Then
ExitLong("손절11",AtStop,EntryPrice-PriceScale*s1);
if MarketPosition == -1 and c > (var1+var2)/2 and c > var2+pricescale*s1 Then
ExitShort("손절12",AtStop,EntryPrice+PriceScale*s1);
감사합니다.
답변 1
예스스탁 예스스탁 답변
2016-01-06 13:19:17
안녕하세요
예스스탁입니다.
익절 = 처음 P1(20틱)에서 1 계약 청산
이후 5 틱씩 수익 발생시마다 1 계약씩 청산.
손절 = 처음 S1(20틱)에서 1 계약 청산
이후 5 틱씩 손실 발생시마다 1 계약씩 청산.
위 내용으로 분할청산하시면 1번식과 같습니다.
기존에 지정하신 조건으로
1계약 첫청산 하고 이후에 +-5틱때 움직일때마다
청산하시면 2번식 이용하시면 됩니다.
1번
##청산(익절)
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts Then
exitlong("매수익절1",AtLimit,EntryPrice+PriceScale*P1,"",1,1);
if CurrentContracts < MaxContracts Then
ExitLong("매수익절2",atlimit,LatestExitPrice(0)+PriceScale*5,"",1,2);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts Then
exitshort("매도익절1",Atlimit,EntryPrice-PriceScale*P1);
if CurrentContracts < MaxContracts Then
exitshort("매도익절2",Atlimit,LatestExitPrice(0)-PriceScale*5);
}
##청산(손절)
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts Then
ExitShort("매수손절1",AtStop,EntryPrice-PriceScale*P1,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("매수손절2",AtStop,LatestExitPrice(0)-PriceScale*5,"",1,2);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts Then
exitshort("매도손절1",AtStop,EntryPrice+PriceScale*P1);
if CurrentContracts < MaxContracts Then
exitshort("매도손절2",AtStop,LatestExitPrice(0)+PriceScale*5);
}
2번
##청산(익절)
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*P1 Then
exitlong("매수익절1",AtLimit,EntryPrice+PriceScale*P1,"",1,1);
if CurrentContracts < MaxContracts Then
ExitLong("매수익절2",atlimit,LatestExitPrice(0)+PriceScale*5,"",1,2);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*P1 Then
exitshort("매도익절1",Atlimit,EntryPrice-PriceScale*P1);
if CurrentContracts < MaxContracts Then
exitshort("매도익절2",Atlimit,LatestExitPrice(0)-PriceScale*5);
}
##청산(손절)
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts and c < (var1+var2)/2 and c < var1-pricescale*s1 Then
ExitShort("매수손절1",AtStop,EntryPrice-PriceScale*P1,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("매수손절2",AtStop,LatestExitPrice(0)-PriceScale*5,"",1,2);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts and c > (var1+var2)/2 and c > var2+pricescale*s1 Then
exitshort("매도손절1",AtStop,EntryPrice+PriceScale*P1);
if CurrentContracts < MaxContracts Then
exitshort("매도손절2",AtStop,LatestExitPrice(0)+PriceScale*5);
}
즐거운 하루되세요
> 베드로 님이 쓴 글입니다.
> 제목 : 청산식 부탁드립니다.
> 안녕하세요
아래 청산식(익절,손절)을 분할청산식으로 변경 부탁드립니다.
=> 처음 지정한 틱수로 1계약 청산후(익절,손절) 다음 청산부터는 직전 청산가격에
+ - 틱으로 청산 (한번 청산된 자리에서는 또 청산되지않게함).
익절 = 처음 P1(20틱)에서 1 계약 청산
이후 5 틱씩 수익 발생시마다 1 계약씩 청산.
손절 = 처음 S1(20틱)에서 1 계약 청산
이후 5 틱씩 손실 발생시마다 1 계약씩 청산.
=============================================================================
##청산(익절)
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*P1 Then
exitlong("btr",AtStop,highest(H,BarsSinceEntry)-PriceScale*1);
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*P1 Then
exitshort("str",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*1);
##청산(손절)
if MarketPosition == 1 and c < (var1+var2)/2 and c < var1-pricescale*s1 Then
ExitLong("손절11",AtStop,EntryPrice-PriceScale*s1);
if MarketPosition == -1 and c > (var1+var2)/2 and c > var2+pricescale*s1 Then
ExitShort("손절12",AtStop,EntryPrice+PriceScale*s1);
감사합니다.