커뮤니티
문의드립니다.
2018-01-16 14:40:08
137
글번호 115815
아래식에서 손절식 추가 부탁드립니다.
손절은 모든 집입의 합이 30틱 손실이면 전 포지션 청산
1
var : T(0),Z(0),HH(0),LL(0);
if Bdate != bdate[1] Then
T = 0;
if crossup(c,dayopen) Then
T = 1;
if CrossDown(c,dayopen) Then
T = -1;
if T == 1 and crossup(C,dayopen+PriceScale*20) Then{
T = 2;
Z = C;
HH = H;
}
if T == -1 and CrossDown(C,dayopen-PriceScale*20) Then{
T = -2;
Z = C;
LL = L;
}
if T == 2 Then{
if H > HH Then
HH = H;
if HH < Z+PriceScale*10 then
buy("b1",AtStop,Z+PriceScale*10,1);
if HH < Z+PriceScale*20 then
buy("b2",AtStop,Z+PriceScale*20,1);
if HH < Z+PriceScale*30 then
buy("b3",AtStop,Z+PriceScale*30,1);
if HH < Z+PriceScale*40 then
buy("b4",AtStop,Z+PriceScale*40,1);
}
if MarketPosition == 1 Then
ExitLong("bx",AtLimit,AvgEntryPrice+PriceScale*30);
if T == -2 Then{
if L < LL Then
LL = L;
if LL > Z-PriceScale*10 then
sell("s1",AtStop,Z-PriceScale*10,1);
if LL > Z-PriceScale*20 then
sell("s2",AtStop,Z-PriceScale*20,1);
if LL > Z-PriceScale*30 then
sell("s3",AtStop,Z-PriceScale*30,1);
if LL > Z-PriceScale*40 then
sell("s4",AtStop,Z-PriceScale*40,1);
}
if MarketPosition == -1 Then
ExitShort("sx",AtLimit,AvgEntryPrice-PriceScale*30);
2
var : T(0),Z(0),HH(0),LL(0);
if Bdate != bdate[1] Then
T = 0;
if crossup(C,dayopen+PriceScale*20) Then{
T = 1;
Z = C;
HH = H;
}
if CrossDown(C,dayopen-PriceScale*20) Then{
T = -1;
Z = C;
LL = L;
}
if T == 1 Then{
if H > HH Then
HH = H;
if HH < Z+PriceScale*10 then
buy("b1",AtStop,Z+PriceScale*10,1);
if HH < Z+PriceScale*20 then
buy("b2",AtStop,Z+PriceScale*20,1);
if HH < Z+PriceScale*30 then
buy("b3",AtStop,Z+PriceScale*30,1);
if HH < Z+PriceScale*40 then
buy("b4",AtStop,Z+PriceScale*40,1);
}
if MarketPosition == 1 Then
ExitLong("bx",AtLimit,AvgEntryPrice+PriceScale*30);
if T == -1 Then{
if L < LL Then
LL = L;
if LL > Z-PriceScale*10 then
sell("s1",AtStop,Z-PriceScale*10,1);
if LL > Z-PriceScale*20 then
sell("s2",AtStop,Z-PriceScale*20,1);
if LL > Z-PriceScale*30 then
sell("s3",AtStop,Z-PriceScale*30,1);
if LL > Z-PriceScale*40 then
sell("s4",AtStop,Z-PriceScale*40,1);
}
if MarketPosition == -1 Then
답변 1
예스스탁 예스스탁 답변
2018-01-17 09:45:25
안녕하세요
예스스탁입니다.
수식에 아래내용 추가하시면 됩니다.
if MarketPosition == 1 Then
ExitLong("bx1",AtLimit,AvgEntryPrice+(PriceScale*30)/CurrentContracts);
if MarketPosition == -1 Then
ExitShort("sx",AtLimit,AvgEntryPrice-(PriceScale*30)/CurrentContracts);
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래식에서 손절식 추가 부탁드립니다.
손절은 모든 집입의 합이 30틱 손실이면 전 포지션 청산
1
var : T(0),Z(0),HH(0),LL(0);
if Bdate != bdate[1] Then
T = 0;
if crossup(c,dayopen) Then
T = 1;
if CrossDown(c,dayopen) Then
T = -1;
if T == 1 and crossup(C,dayopen+PriceScale*20) Then{
T = 2;
Z = C;
HH = H;
}
if T == -1 and CrossDown(C,dayopen-PriceScale*20) Then{
T = -2;
Z = C;
LL = L;
}
if T == 2 Then{
if H > HH Then
HH = H;
if HH < Z+PriceScale*10 then
buy("b1",AtStop,Z+PriceScale*10,1);
if HH < Z+PriceScale*20 then
buy("b2",AtStop,Z+PriceScale*20,1);
if HH < Z+PriceScale*30 then
buy("b3",AtStop,Z+PriceScale*30,1);
if HH < Z+PriceScale*40 then
buy("b4",AtStop,Z+PriceScale*40,1);
}
if MarketPosition == 1 Then
ExitLong("bx",AtLimit,AvgEntryPrice+PriceScale*30);
if T == -2 Then{
if L < LL Then
LL = L;
if LL > Z-PriceScale*10 then
sell("s1",AtStop,Z-PriceScale*10,1);
if LL > Z-PriceScale*20 then
sell("s2",AtStop,Z-PriceScale*20,1);
if LL > Z-PriceScale*30 then
sell("s3",AtStop,Z-PriceScale*30,1);
if LL > Z-PriceScale*40 then
sell("s4",AtStop,Z-PriceScale*40,1);
}
if MarketPosition == -1 Then
ExitShort("sx",AtLimit,AvgEntryPrice-PriceScale*30);
2
var : T(0),Z(0),HH(0),LL(0);
if Bdate != bdate[1] Then
T = 0;
if crossup(C,dayopen+PriceScale*20) Then{
T = 1;
Z = C;
HH = H;
}
if CrossDown(C,dayopen-PriceScale*20) Then{
T = -1;
Z = C;
LL = L;
}
if T == 1 Then{
if H > HH Then
HH = H;
if HH < Z+PriceScale*10 then
buy("b1",AtStop,Z+PriceScale*10,1);
if HH < Z+PriceScale*20 then
buy("b2",AtStop,Z+PriceScale*20,1);
if HH < Z+PriceScale*30 then
buy("b3",AtStop,Z+PriceScale*30,1);
if HH < Z+PriceScale*40 then
buy("b4",AtStop,Z+PriceScale*40,1);
}
if MarketPosition == 1 Then
ExitLong("bx",AtLimit,AvgEntryPrice+PriceScale*30);
if T == -1 Then{
if L < LL Then
LL = L;
if LL > Z-PriceScale*10 then
sell("s1",AtStop,Z-PriceScale*10,1);
if LL > Z-PriceScale*20 then
sell("s2",AtStop,Z-PriceScale*20,1);
if LL > Z-PriceScale*30 then
sell("s3",AtStop,Z-PriceScale*30,1);
if LL > Z-PriceScale*40 then
sell("s4",AtStop,Z-PriceScale*40,1);
}
if MarketPosition == -1 Then