커뮤니티
분할매도시
2017-03-14 15:18:14
129
글번호 107773
5퍼이상 상승 이후에 보합이나 1퍼상승부근까지 다시 내려올경우
완전매도하는 수식 추가가 가능할런지요?
지금은 분할매도로 해뒀는데 BX1 1차매도 BX2 이차매도 이런식으로 해뒀지만,
만약 BX1 1차매도 후에 다시 떨어지면 손절선까지 떨어져야 완전 매도하게 되더군요.
그러면 올랐었지만 손해보고 파는경우가 되어버려서요.
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
if MarketPosition == 1 then{
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.02 and HH < EntryPrice*1.03 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.03 and HH < EntryPrice*1.05 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.07 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1);
}
Else{
Bxcond1 = false;
Bxcond2 = false;
Bxcond3 = false;
}
if MarketPosition == -1 then{
LL = Lowest(L,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx1" Then
Sxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx2" Then
Sxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx3" Then
Sxcond3 = true;
if Sxcond1 == false and LL <= EntryPrice*0.98 and LL < EntryPrice*0.97 Then
ExitShort("Sx1",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond2 == false and LL <= EntryPrice*0.97 and LL < EntryPrice*0.96 Then
ExitShort("Sx2",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond3 == false and LL <= EntryPrice*0.95 Then
ExitShort("Sx3",AtStop,LL+(EntryPrice-LL)*0.3);
}
Else{
Sxcond1 = false;
Sxcond2 = false;
Sxcond3 = false;
}
답변 1
예스스탁 예스스탁 답변
2017-03-14 17:43:30
안녕하세요
예스스탁입니다.
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false),Bxcond4(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false),Sxcond4(false);
if MarketPosition == 1 then{
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx4" Then
Bxcond4 = true;
if Bxcond1 == false and HH >= EntryPrice*1.02 and HH < EntryPrice*1.03 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.03 and HH < EntryPrice*1.05 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.07 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1);
if Bxcond4 == false and HH >= EntryPrice*1.05 Then
ExitLong("Bx4",AtStop,EntryPrice*1.01);
}
Else{
Bxcond1 = false;
Bxcond2 = false;
Bxcond3 = false;
Bxcond4 = false;
}
if MarketPosition == -1 then{
LL = Lowest(L,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx1" Then
Sxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx2" Then
Sxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx3" Then
Sxcond3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx4" Then
Sxcond4 = true;
if Sxcond1 == false and LL <= EntryPrice*0.98 and LL < EntryPrice*0.97 Then
ExitShort("Sx1",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond2 == false and LL <= EntryPrice*0.97 and LL < EntryPrice*0.96 Then
ExitShort("Sx2",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond3 == false and LL <= EntryPrice*0.93 Then
ExitShort("Sx3",AtStop,LL+(EntryPrice-LL)*0.3);
if Sxcond3 == false and LL <= EntryPrice*0.95 Then
ExitShort("Sx4",AtStop,EntryPrice*0.99);
}
Else{
Sxcond1 = false;
Sxcond2 = false;
Sxcond3 = false;
Sxcond4 = false;
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 분할매도시
> 5퍼이상 상승 이후에 보합이나 1퍼상승부근까지 다시 내려올경우
완전매도하는 수식 추가가 가능할런지요?
지금은 분할매도로 해뒀는데 BX1 1차매도 BX2 이차매도 이런식으로 해뒀지만,
만약 BX1 1차매도 후에 다시 떨어지면 손절선까지 떨어져야 완전 매도하게 되더군요.
그러면 올랐었지만 손해보고 파는경우가 되어버려서요.
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
if MarketPosition == 1 then{
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.02 and HH < EntryPrice*1.03 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.03 and HH < EntryPrice*1.05 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.07 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1);
}
Else{
Bxcond1 = false;
Bxcond2 = false;
Bxcond3 = false;
}
if MarketPosition == -1 then{
LL = Lowest(L,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx1" Then
Sxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx2" Then
Sxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Sx3" Then
Sxcond3 = true;
if Sxcond1 == false and LL <= EntryPrice*0.98 and LL < EntryPrice*0.97 Then
ExitShort("Sx1",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond2 == false and LL <= EntryPrice*0.97 and LL < EntryPrice*0.96 Then
ExitShort("Sx2",AtStop,LL+(EntryPrice-LL)*0.3,"",Floor(MaxContracts*(1/3)),1);
if Sxcond3 == false and LL <= EntryPrice*0.95 Then
ExitShort("Sx3",AtStop,LL+(EntryPrice-LL)*0.3);
}
Else{
Sxcond1 = false;
Sxcond2 = false;
Sxcond3 = false;
}
다음글