커뮤니티
시스템식 질문입니다.
2016-06-13 23:46:53
128
글번호 99024
제가 여러가지 형태로 생각해보고 있습니다.
현재는 당일에 3회에 걸친 익절이나 손절이 아니면 익일이나 익익일까지 끌고 가는데,
혹시 당일에 1회라도 익절이나 손절이 나오는 경우에는 당일 2:30에 매도하는 형태로 수정해보고 싶습니다.
감사합니다.
input: 매수금액1(8000000),매수금액2(12000000),지정일(20160613);
var : Ev(0),Xv(0),Xcond(false),Nday(0),OpenPrice(0);
if bdate != bdate[1] Then{
Nday = Nday+1;
Xcond = false;
}
if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then
Xcond = true;
if MarketPosition == 0 and NextBarSdate == 지정일 and Xcond == false and
NextBarOpen < C*1.05 and
dayindex == 0 Then {
buy("b",OnClose,def,Floor(매수금액1/C));
Openprice = CloseD(1); }
if MarketPosition == 1 Then{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{
Condition11 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{
Condition12 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition21 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition22 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then
Condition23 = true;
if MaxEntries == 1 and
highest(H,BarsSinceEntry) < EntryPrice*1.05 and stime < 110000 and
MaxContracts == CurrentContracts Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/100));
}
if MaxEntries ==1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.95,"");
// if Condition12 == false Then
// exitlong("BL3",AtStop,AvgEntryPrice*0.955);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv*40,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,OpenPrice*1.29);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.90);
}
if MaxEntries ==2 Then{
if Condition11 == false Then
exitlong("BL11",AtStop,AvgEntryPrice*0.967,"");
// if Condition12 == false Then
// exitlong("BL33",AtStop,AvgEntryPrice*0.95);
if Condition21 == false Then
exitlong("BP11",AtLimit,AvgEntryPrice*1.05,"",xv*60,1);
if Condition22 == false Then
exitlong("BP22",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP33",AtLimit,OpenPrice*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr2",AtStop,highest(H,BarsSinceEntry)*0.90);
}
// if sdate > Nday[BarsSinceEntry]+1 and stime == 144500 Then
If DayOfWeek(지정일) == 1 Then {
if (DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5) and stime>=143000 Then
exitlong("bx월-수");
}
If DayOfWeek(지정일) == 2 Then {
if (DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1) and stime>=143000 Then
exitlong("bx화-목");
}
If DayOfWeek(지정일) == 3 Then {
if (DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2) and stime>=143000 Then
exitlong("수-금");
}
If DayOfWeek(지정일) == 4 Then {
if (DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3) and stime>=143000 Then
exitlong("bx목-월");
}
If DayOfWeek(지정일) == 5 Then {
if (DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4) and stime>=143000 Then
exitlong("bx금-화");
}
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}
답변 1
예스스탁 예스스탁 답변
2016-06-14 11:00:25
안녕하세요
예스스탁입니다.
input: 매수금액1(8000000),매수금액2(12000000),지정일(20160613);
var : Ev(0),Xv(0),Xcond(false),Nday(0),OpenPrice(0);
if bdate != bdate[1] Then{
Nday = Nday+1;
Xcond = false;
}
if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then
Xcond = true;
if MarketPosition == 0 and NextBarSdate == 지정일 and Xcond == false and
NextBarOpen < C*1.05 and
dayindex == 0 Then {
buy("b",OnClose,def,Floor(매수금액1/C));
Openprice = CloseD(1);
}
if MarketPosition == 1 Then{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{
Condition11 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{
Condition12 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition21 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition22 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then
Condition23 = true;
if MaxEntries == 1 and
highest(H,BarsSinceEntry) < EntryPrice*1.05 and stime < 110000 and
MaxContracts == CurrentContracts Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/100));
}
if MaxEntries ==1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.95,"");
// if Condition12 == false Then
// exitlong("BL3",AtStop,AvgEntryPrice*0.955);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv*40,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,OpenPrice*1.29);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.90);
}
if MaxEntries ==2 Then{
if Condition11 == false Then
exitlong("BL11",AtStop,AvgEntryPrice*0.967,"");
// if Condition12 == false Then
// exitlong("BL33",AtStop,AvgEntryPrice*0.95);
if Condition21 == false Then
exitlong("BP11",AtLimit,AvgEntryPrice*1.05,"",xv*60,1);
if Condition22 == false Then
exitlong("BP22",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP33",AtLimit,OpenPrice*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr2",AtStop,highest(H,BarsSinceEntry)*0.90);
}
#당일 청산이 1회이상 발생했으면 14시30분에 청산
if countif(CurrentContracts < CurrentContracts[1],dayindex+1) >= 1 and stime >= 143000 Then
exitlong();
// if sdate > Nday[BarsSinceEntry]+1 and stime == 144500 Then
If DayOfWeek(지정일) == 1 Then {
if (DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5) and stime>=143000 Then
exitlong("bx월-수");
}
If DayOfWeek(지정일) == 2 Then {
if (DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1) and stime>=143000 Then
exitlong("bx화-목");
}
If DayOfWeek(지정일) == 3 Then {
if (DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2) and stime>=143000 Then
exitlong("수-금");
}
If DayOfWeek(지정일) == 4 Then {
if (DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3) and stime>=143000 Then
exitlong("bx목-월");
}
If DayOfWeek(지정일) == 5 Then {
if (DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4) and stime>=143000 Then
exitlong("bx금-화");
}
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}
즐거운 하루되세요
> 깜피 님이 쓴 글입니다.
> 제목 : 시스템식 질문입니다.
> 제가 여러가지 형태로 생각해보고 있습니다.
현재는 당일에 3회에 걸친 익절이나 손절이 아니면 익일이나 익익일까지 끌고 가는데,
혹시 당일에 1회라도 익절이나 손절이 나오는 경우에는 당일 2:30에 매도하는 형태로 수정해보고 싶습니다.
감사합니다.
input: 매수금액1(8000000),매수금액2(12000000),지정일(20160613);
var : Ev(0),Xv(0),Xcond(false),Nday(0),OpenPrice(0);
if bdate != bdate[1] Then{
Nday = Nday+1;
Xcond = false;
}
if TotalTrades > TotalTrades[1] and (LatestExitName(1) == "BL1" or LatestExitName(1) == "BL2") Then
Xcond = true;
if MarketPosition == 0 and NextBarSdate == 지정일 and Xcond == false and
NextBarOpen < C*1.05 and
dayindex == 0 Then {
buy("b",OnClose,def,Floor(매수금액1/C));
Openprice = CloseD(1); }
if MarketPosition == 1 Then{
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL1" Then{
Condition11 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BL2" Then{
Condition12 = true;
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP1" Then
Condition21 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP2" Then
Condition22 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "BP3" Then
Condition23 = true;
if MaxEntries == 1 and
highest(H,BarsSinceEntry) < EntryPrice*1.05 and stime < 110000 and
MaxContracts == CurrentContracts Then
buy("bb",Atlimit,EntryPrice*0.97,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/100));
}
if MaxEntries ==1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.95,"");
// if Condition12 == false Then
// exitlong("BL3",AtStop,AvgEntryPrice*0.955);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv*40,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,OpenPrice*1.29);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.90);
}
if MaxEntries ==2 Then{
if Condition11 == false Then
exitlong("BL11",AtStop,AvgEntryPrice*0.967,"");
// if Condition12 == false Then
// exitlong("BL33",AtStop,AvgEntryPrice*0.95);
if Condition21 == false Then
exitlong("BP11",AtLimit,AvgEntryPrice*1.05,"",xv*60,1);
if Condition22 == false Then
exitlong("BP22",AtLimit,AvgEntryPrice*1.10,"",xv*30,1);
if Condition23 == false Then
exitlong("BP33",AtLimit,OpenPrice*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr2",AtStop,highest(H,BarsSinceEntry)*0.90);
}
// if sdate > Nday[BarsSinceEntry]+1 and stime == 144500 Then
If DayOfWeek(지정일) == 1 Then {
if (DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5) and stime>=143000 Then
exitlong("bx월-수");
}
If DayOfWeek(지정일) == 2 Then {
if (DayOfWeek(sdate)==4 or DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1) and stime>=143000 Then
exitlong("bx화-목");
}
If DayOfWeek(지정일) == 3 Then {
if (DayOfWeek(sdate)==5 or DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2) and stime>=143000 Then
exitlong("수-금");
}
If DayOfWeek(지정일) == 4 Then {
if (DayOfWeek(sdate)==1 or DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3) and stime>=143000 Then
exitlong("bx목-월");
}
If DayOfWeek(지정일) == 5 Then {
if (DayOfWeek(sdate)==2 or DayOfWeek(sdate)==3 or DayOfWeek(sdate)==4) and stime>=143000 Then
exitlong("bx금-화");
}
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}