커뮤니티
시스템식 질문입니다.(수정)
2016-04-20 10:54:03
127
글번호 97254
분할 매수, 매도 식인데 초회 매수 후 상승해도 분할해서 매도 가능한 형태로 수정 부탁드리겠습니다.
감사합니다.
----------------------------------------------------------------------------------
47272번에 대한 추가 질문입니다.
만들어주셨던 식을 4.19일 한화(000880) 1분봉에 적용시켜보니까
9:01에 37,400에 매수됐습니다.
그런데 고가가 39,850임에도 불구하고 원래 질문이었던 5% 수익 시 절반 매도 부분이
적용이 안됐습니다.
이 부분 확인 좀 부탁드리겠습니다.
감사합니다.
input: 매수금액1(10000000),매수금액2(10000000);
var : Ev(0),Xv(0);
if MarketPosition == 0 and NextBarSdate > sdate Then
buy("b",AtMarket,def,Floor(매수금액1/C));
if MarketPosition == 1 Then{
if MaxEntries == 1 Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
if CurrentContracts == MaxContracts Then
Xv = Floor(MaxContracts*0.5);
Else
xv = CurrentContracts;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then
Condition1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then
Condition2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition4 = true;
if MaxEntries == 2 Then{
if Condition1 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition2 == false Then
exitlong("BL2",AtStop,AvgEntryPrice*0.94);
if Condition3 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition4 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10);
}
if sdate > EntryDate and stime == 143000 Then
exitlong();
}
else{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
}
답변 1
예스스탁 예스스탁 답변
2016-04-20 14:05:59
안녕하세요
예스스탁입니다.
"3% 하락 시 추가 1000만원 매수 하고"
"평단가 대비 3% 하락시 절반 손절"
올려주신 식내용중 일부입니다.
현재수식의 청산 중 손절이 3%라 추가진입과 동일가격이라
모든 청산이 추가진입이후에 발동하는 것으로 생각하고 작성했습니다.
첫진입부터 발동되게 하면 추가진입의 가격과 손절이 가격이 같아
추가진입후 동일시점에 청산발생하게 됩니다.
위 내용은 참고하시기 바랍니다.
수식은 첫진입이후부터 발동되게 수정해 드립니다.
input: 매수금액1(10000000),매수금액2(10000000);
var : Ev(0),Xv(0);
if MarketPosition == 0 and NextBarSdate > sdate Then
buy("b",AtMarket,def,Floor(매수금액1/C));
if MarketPosition == 1 Then{
if MaxEntries == 1 Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
if CurrentContracts == MaxContracts Then
Xv = Floor(MaxContracts*0.5);
Else
xv = CurrentContracts;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then
Condition1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then
Condition2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition4 = true;
if MaxEntries >= 1 Then{
if Condition1 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition2 == false Then
exitlong("BL2",AtStop,AvgEntryPrice*0.94);
if Condition3 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition4 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10);
}
if sdate > EntryDate and stime == 143000 Then
exitlong();
}
else{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
}
즐거운 하루되세요
> 깜피 님이 쓴 글입니다.
> 제목 : 시스템식 질문입니다.(수정)
> 분할 매수, 매도 식인데 초회 매수 후 상승해도 분할해서 매도 가능한 형태로 수정 부탁드리겠습니다.
감사합니다.
----------------------------------------------------------------------------------
47272번에 대한 추가 질문입니다.
만들어주셨던 식을 4.19일 한화(000880) 1분봉에 적용시켜보니까
9:01에 37,400에 매수됐습니다.
그런데 고가가 39,850임에도 불구하고 원래 질문이었던 5% 수익 시 절반 매도 부분이
적용이 안됐습니다.
이 부분 확인 좀 부탁드리겠습니다.
감사합니다.
input: 매수금액1(10000000),매수금액2(10000000);
var : Ev(0),Xv(0);
if MarketPosition == 0 and NextBarSdate > sdate Then
buy("b",AtMarket,def,Floor(매수금액1/C));
if MarketPosition == 1 Then{
if MaxEntries == 1 Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
if CurrentContracts == MaxContracts Then
Xv = Floor(MaxContracts*0.5);
Else
xv = CurrentContracts;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then
Condition1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then
Condition2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition3 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition4 = true;
if MaxEntries == 2 Then{
if Condition1 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition2 == false Then
exitlong("BL2",AtStop,AvgEntryPrice*0.94);
if Condition3 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition4 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10);
}
if sdate > EntryDate and stime == 143000 Then
exitlong();
}
else{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
}