커뮤니티
시스템식 문의
2013-06-27 13:17:09
180
글번호 64751
늘 감사드리는 마음입니다.
답변 1
예스스탁 예스스탁 답변
2013-06-27 11:49:37
안녕하세요
예스스탁입니다.
5개까지 보유하고 청산하는 내용이 없어
평균가대비 A5수익나면 청산하는 내용을 추가했습니다.
(sx5,bx5 청산식입니다.필요없는 부분이시면 삭제하시면 됩니다.)
진입후 모두 청산뒤에 해당 포지션과 관계없이
청산가격에서 P1올라가면 매도로 진입하고
P1하락하면 매수로 진입하고자 하시면
두번재 이후에 나오는 첫진입식(Ss,BB)의
MarketPosition(1) == -1와 MarketPosition(1) == 1을 삭제하시면 됩니다.
input : P1(1),A1(1),P2(1),A2(1),P3(1),A3(1),P4(1),A4(1),P5(1),A5(1);
var : LL(0),HH(0),cnt(0),count(0);
LL = lowest(L,10)[1];
HH = highest(H,10)[1];
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if count == 0 and MarketPosition == 0 Then{
if crossup(C,LL+P1) Then
sell("S",OnClose,def,1);
}
if count > 0 and MarketPosition == 0 and MarketPosition(1) == -1 Then{
if crossup(C,ExitPrice(1)+P1) Then
sell("SS",OnClose,def,1);
}
if count == 0 and MarketPosition == 0 Then{
if crossup(C,HH-P1) Then
Buy("B",OnClose,def,1);
}
if count > 0 and MarketPosition == 0 and MarketPosition(1) == 1 Then{
if crossup(C,ExitPrice(1)-P1) Then
buy("BB",OnClose,def,1);
}
if MarketPosition == -1 Then{
if CurrentEntries == 1 Then{
ExitShort("sx1",atlimit,EntryPrice-A1);
if crossup(c,EntryPrice+P2) Then{
Sell("AddS2",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 2 Then{
ExitShort("sx2",atlimit,AvgEntryPrice-A2);
if crossup(c,var1+P3) Then{
Sell("AddS3",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 3 Then{
ExitShort("sx3",atlimit,AvgEntryPrice-A3);
if crossup(c,var1+P4) Then{
Sell("AddS4",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 4 Then{
ExitShort("sx4",atlimit,AvgEntryPrice-A4);
if crossup(c,var1+P5) Then{
Sell("AddS5",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 5 Then{
ExitShort("sx5",atlimit,AvgEntryPrice-A5);
}
}
if MarketPosition == 1 Then{
if CurrentEntries == 1 Then{
ExitLong("Bx1",atlimit,EntryPrice+A1);
if CrossDown(c,EntryPrice-P2) Then{
Buy("AddB1",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 2 Then{
ExitLong("Bx2",atlimit,AvgEntryPrice+A2);
if CrossDown(c,var1-P3) Then{
Buy("AddB2",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 3 Then{
ExitLong("Bx3",atlimit,AvgEntryPrice+A3);
if CrossDown(c,var1-P4) Then{
Buy("AddB3",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 4 Then{
ExitLong("Bx4",atlimit,AvgEntryPrice+A4);
if CrossDown(c,var1-P5) Then{
Buy("AddB4",OnClose,def,1);
var1 = C;
}
}
if CurrentEntries == 5 Then{
ExitLong("Bx5",atlimit,AvgEntryPrice+A5);
}
}
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 시스템식 문의
> 늘 감사드리는 마음입니다.