커뮤니티
부탁 드립니다.
2013-12-31 10:04:05
159
글번호 70947
빠른 답변 고맙습니다.
34123번 답변에서 손실 났을 때 두 배로 진입하는 수식은 빠졌네요.
추가 부탁 드립니다.
새해 복 많이 받으세요.
답변 1
예스스탁 예스스탁 답변
2014-01-02 18:39:32
안녕하세요
예스스탁입니다.
죄송합니다. 직전거래 손실이면 계약수 2배가 되게
수정했습니다. 3번연속 수익이나 손실시 반대로 진입하고
계약수는 1계약부터 다시 시작합니다.
var : cnt(0),Bloss(0),Sloss(0),Bprofit(0),Sprofit(0),TT(0);
var : Va1(0),va2(0),Va3(0);
BLoss = 0;
Sloss = 0;
BProfit = 0;
SProfit = 0;
for cnt = 1 to 3{
#최근 3회거래에서 매수손실인 거래횟수
if PositionProfit(cnt) < 0 and MarketPosition(cnt) == 1 Then
Bloss = Bloss+1;
#최근 3회거래에서 매수수익인 거래횟수
if PositionProfit(cnt) > 0 and MarketPosition(cnt) == 1 Then
BProfit = BProfit+1;
#최근 3회거래에서 매도손실인 거래횟수
if PositionProfit(cnt) < 0 and MarketPosition(cnt) == -1 Then
Sloss = Sloss+1;
#최근 3회거래에서 매도수익 거래횟수
if PositionProfit(cnt) > 0 and MarketPosition(cnt) == -1 Then
SProfit = SProfit+1;
}
va1 = int(date/100)-int(date/10000)*100;
va2 = date - int(date/100)*100;
va3 = DayOfWeek(date);
if va1%3 == 0 and va2 >= 8 and va2 <= 14 and va3 == 4 then{#선물만기일
TT = 144900; #마지막봉시간 14시49분
SetStopEndofday(140000); #당일청산은 14시
}
else if sdate == 20131107 or sdate == 20121108 Then{ #수능일
TT = 161500; #마지막봉시간 16시 15분
SetStopEndofday(160000); #당일청산은 16시
}
Else{ #평일
TT = 151500;#마지막봉시간 15시 15분
SetStopEndofday(150000);#당일청산은 15시
}
if stime == TT Then{
if stime == TT /*매수조건*/ then{
if (TotalTrades == 0 or
(TotalTrades >= 1 and (Sloss == 3 or SProfit == 3) and MarketPosition(1) == -1))Then
buy("매수",AtMarket,1);
if TotalTrades >= 1 and (Bprofit < 3) and PositionProfit(1) > 0 and MarketPosition(1) == 1 Then
buy("매수1",AtMarket,def,MaxContracts(1));
if TotalTrades >= 1 and (Bloss < 3 ) and PositionProfit(1) < 0 and MarketPosition(1) == 1 Then
buy("매수1.",AtMarket,def,MaxContracts(1)*2);
}
if stime == TT /*매도조건*/ then{
if (TotalTrades == 0 or
(TotalTrades >= 1 and (Bloss == 3 or Bprofit == 3) and MarketPosition(1) == 1)) Then
sell("매도",AtMarket,1);
if TotalTrades >= 1 and ( SProfit < 3) and PositionProfit(1) > 0 and MarketPosition(1) == -1 Then
sell("매도1",AtMarket,def,MaxContracts(1));
if TotalTrades >= 1 and (Sloss < 3 ) and PositionProfit(1) < 0 and MarketPosition(1) == -1 Then
sell("매도1.",AtMarket,def,MaxContracts(1)*2);
}
}
#30틱 수익시 청산
SetStopProfittarget(30*PriceScale,PointStop);
#15틱 손실시 청산
SetStopLoss(15*PriceScale,PointStop);
즐거운 하루되세요
> 고운무지개 님이 쓴 글입니다.
> 제목 : 부탁 드립니다.
> 빠른 답변 고맙습니다.
34123번 답변에서 손실 났을 때 두 배로 진입하는 수식은 빠졌네요.
추가 부탁 드립니다.
새해 복 많이 받으세요.