커뮤니티
문의 드립니다.
2013-03-22 11:49:01
210
글번호 61040
늘 감사한 마음입니다.
답변 1
예스스탁 예스스탁 답변
2013-03-22 11:13:06
안녕하세요
예스스탁입니다.
1.
청산함수는 진입당 한번만 발생되게 되어 있어
가령 매수후에 VV값이 순차적으로 발생하면
하나의 청산함수로는 발생하지 않아 진입수량별로 작성이 되어 있습니다.
VV값이 범위가 넓어지면 해당 내용도 감안하셔서 추가하셔야 합니다.
var : VV(0);
if dayindex == 0 or MarketPosition == 0 or MarketPosition == -1 Then{
if VV > 0 Then
buy("b1",OnClose,def,abs(VV));
}
if dayindex == 0 or MarketPosition == 0 or MarketPosition == 1 Then{
if VV < 0 Then
sell("s1",OnClose,def,abs(VV));
}
if dayindex >= 0 and MarketPosition == 1 and VV > 0 Then{
if VV > VV[1] Then
buy("bb",OnClose,def,VV-VV[1]);
if VV < VV[1] Then{
if CurrentContracts == 5 Then
ExitLong("bx1",OnClose,def,"",VV[1]-VV,1);
if CurrentContracts == 4 Then
ExitLong("bx2",OnClose,def,"",VV[1]-VV,1);
if CurrentContracts == 3 Then
ExitLong("bx3",OnClose,def,"",VV[1]-VV,1);
if CurrentContracts == 2 Then
ExitLong("bx4",OnClose,def,"",VV[1]-VV,1);
}
}
if MarketPosition == 1 and VV == 0 Then
exitlong("bx");
if dayindex >= 0 and MarketPosition == -1 and VV < 0 Then{
if VV < VV[1] Then
Sell("ss",OnClose,def,abs(VV-VV[1]));
if VV > VV[1] Then{
if CurrentContracts == 5 Then
ExitShort("sx1",OnClose,def,"",abs(VV[1]-VV),1);
if CurrentContracts == 4 Then
ExitShort("sx2",OnClose,def,"",abs(VV[1]-VV),1);
if CurrentContracts == 3 Then
ExitShort("sx3",OnClose,def,"",abs(VV[1]-VV),1);
if CurrentContracts == 2 Then
ExitShort("sx4",OnClose,def,"",abs(VV[1]-VV),1);
}
}
if MarketPosition == -1 and VV == 0 Then
ExitShort();
var : va1(0),va2(0),va3(0),선물만기일(0);
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
SetStopEndofday(144000);
Else
SetStopEndofday(150000);
2.
2번의 문의하신 부분은 1번과 같은 식입니다.
단지 식상에 사용하시는 VV값을 2로 나누어 정수값만 취하게 해주시면 됩니다.
var : VV(0),VVV(0);
VVV = int(VV/2);
if dayindex == 0 or MarketPosition == 0 or MarketPosition == -1 Then{
if VVV > 0 Then
buy("b1",OnClose,def,abs(VVV));
}
if dayindex == 0 or MarketPosition == 0 or MarketPosition == 1 Then{
if VVV < 0 Then
sell("s1",OnClose,def,abs(VVV));
}
if dayindex >= 0 and MarketPosition == 1 and VVV > 0 Then{
if VVV > VVV[1] Then
buy("bb",OnClose,def,VVV-VVV[1]);
if VVV < VVV[1] Then{
if CurrentContracts == 5 Then
ExitLong("bx1",OnClose,def,"",VVV[1]-VVV,1);
if CurrentContracts == 4 Then
ExitLong("bx2",OnClose,def,"",VVV[1]-VVV,1);
if CurrentContracts == 3 Then
ExitLong("bx3",OnClose,def,"",VVV[1]-VVV,1);
if CurrentContracts == 2 Then
ExitLong("bx4",OnClose,def,"",VVV[1]-VVV,1);
}
}
if MarketPosition == 1 and VVV == 0 Then
exitlong("bx");
if dayindex >= 0 and MarketPosition == -1 and VVV < 0 Then{
if VVV < VVV[1] Then
Sell("ss",OnClose,def,abs(VVV-VVV[1]));
if VVV > VVV[1] Then{
if CurrentContracts == 5 Then
ExitShort("sx1",OnClose,def,"",abs(VVV[1]-VVV),1);
if CurrentContracts == 4 Then
ExitShort("sx2",OnClose,def,"",abs(VVV[1]-VVV),1);
if CurrentContracts == 3 Then
ExitShort("sx3",OnClose,def,"",abs(VVV[1]-VVV),1);
if CurrentContracts == 2 Then
ExitShort("sx4",OnClose,def,"",abs(VVV[1]-VVV),1);
}
}
if MarketPosition == -1 and VVV == 0 Then
ExitShort();
var : va1(0),va2(0),va3(0),선물만기일(0);
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
SetStopEndofday(144000);
Else
SetStopEndofday(150000);
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 늘 감사한 마음입니다.
다음글
이전글