커뮤니티
문의 드립니다
2013-04-02 19:53:52
175
글번호 61540
늘 감사합니다.
답변 1
예스스탁 예스스탁 답변
2013-04-02 17:58:43
안녕하세요
예스스탁입니다.
1.
var : VV(0),VVV(0);
VVV = int(VV/2);
if MarketPosition == 0 Then{
if VVV < 0 Then
sell("s1",OnClose,def,abs(VVV));
}
if MarketPosition == -1 and VVV < 0 Then{
if abs(VVV) < CurrentContracts and CurrentContracts < 7 Then
Sell("ss",OnClose,def,abs(VVV)-CurrentContracts);
if abs(VVV) < CurrentContracts Then{
if CurrentContracts == 7 Then
ExitShort("sx1",OnClose,def,"",CurrentContracts-Abs(VVV),1);
if CurrentContracts == 6 Then
ExitShort("sx2",OnClose,def,"",CurrentContracts-Abs(VVV),1);
if CurrentContracts == 5 Then
ExitShort("sx3",OnClose,def,"",CurrentContracts-Abs(VVV),1);
if CurrentContracts == 4 Then
ExitShort("sx4",OnClose,def,"",CurrentContracts-Abs(VVV),1);
if CurrentContracts == 3 Then
ExitShort("sx5",OnClose,def,"",CurrentContracts-Abs(VVV),1);
if CurrentContracts == 2 Then
ExitShort("sx6",OnClose,def,"",CurrentContracts-Abs(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(145000);
2.
input : a1(3),a2(3),k(4),c1(5),c2(30);
if MarketPosition == 0 and CrossDown(c,dayhigh*(1-a1/100)) Then
sell();
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
var1 = H;
var2 = L;
}
if H > var1 Then
var1 = H;
if L < var2 Then
var2 = L;
if CrossDown(c,var1*(1-a2/100)) Then
sell();
if CrossUp(c,var2*(1+a2/100)) Then
ExitShort("sx",OnClose,def,"",iff(CurrentContracts >= K,2,1),1);
}
#개별진입별로 청산하기 위해서는 강제청산 SetStopTrailing사용해야 합니다.
SetStopTrailing(c2,c1,PercentStop,0);#c1수익이후 c2이상 수익감소하면 청산
2-2
input : a1(3),a2(3),k(4),c1(5),c2(30);
if MarketPosition == 0 Then
sell("s",AtStop,dayhigh*(1-a1/100));
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
var1 = H;
var2 = L;
}
if H > var1 Then
var1 = H;
if L < var2 Then
var2 = L;
Sell("ss",AtStop,var1*(1-a2/100));
ExitShort("sx",AtStop,var2*(1+a2/100),"",iff(CurrentContracts >= K,2,1),1);
}
SetStopTrailing(c2,c1,PercentStop,0);#c1수익이후 c2이상 수익감소하면 청산
3.
input : n(Numeric),K(Numeric);
var : sum(0),mav(0),cnt(0),TT(0),count(0),P(0);
Array : CC[100](0);
TT = dayindex%5;
if date != date[1] Then{
count = 0;
if K < 0 Then
sum = 0;
}
if TT == 0 and K > 0 Then{
count = count+1;
CC[0] = C;
for cnt = 1 to 99{
CC[cnt]-CC[cnt-1][1];
}
if count < K Then
P = count;
Else
P = k;
sum = 0;
for cnt = 0 to P-1{
sum = sum+CC[cnt];
}
ma3 = sum/P;
}
if TT == 0 and K < 0 Then{
count = count+1;
sum = sum+C;
ma3 = sum/count;
}
3-2
위 함수를 참조데이터에 사용하실때 data2(ma3(10,5))와 같이 작성해 사용하시면 됩니다.
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> 늘 감사합니다.
다음글
이전글