커뮤니티
수식 변경 요청
2016-06-04 12:24:37
104
글번호 98740
만들어 주신 수식을 잘 사용하고 있습니다.
과거에 하락시 분할 매수하는 형태로 컨셉을 잡았었는데,
하락 후 돌파시 추가 매수하는 형태로 수식을 변경해보고 싶습니다.
예를 들어 최초 매수(보통 첫번째 봉 종가 등)에서 매수 한 후에,
주가가 당일 시가 이하로 하락했다가 시가 회복시 추가 매수하고 해서
당일에 총 2회만 매수하고 싶습니다.
장이 루즈해질 경우도 있으므로 당일 11시까지 시가 회복을 못하면 2차분은 매수하지 않는 걸로 하구요.
당일에 1차분만 매수 조건이 나오고 익일에 추가 매수 조건이 나온다고 해도
익일에는 매수 진입을 하지 않고, 청산 조건을 충족하지 못해도 익일에는 매수 진입은 안하려고 합니다.(기존 수식은 익일에 조건 만족시 매수 진입됩니다)
그리고
if Nday > Nday[BarsSinceEntry]+1 and stime == 144500 Then
exitlong("bx");
익일 청산인데 상기 부분에서 익일 청산이 안되고 있는데, 확인 부탁드리겠습니다.
항상 감사드립니다.
------------------------------------------------------------------------------------
input: 매수금액1(10000000),매수금액2(10000000),지정일(20160525);
var : Ev(0),Xv(0),Xcond(false),Nday(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));
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
MaxContracts == CurrentContracts Then
buy("bb",Atlimit,EntryPrice*0.98,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/3));
}
if MaxEntries >=1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition12 == false Then
exitlong("BL3",AtStop,AvgEntryPrice*0.96);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,AvgEntryPrice*1.20);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.95);
}
if Nday > Nday[BarsSinceEntry]+1 and stime == 144500 Then
exitlong("bx");
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}
답변 1
예스스탁 예스스탁 답변
2016-06-07 15:29:47
안녕하세요
예스스탁입니다.
추가매수를 첫진입 당일 11시 이전까지 시가를 상향돌파할때로 수정했습니다.
청산이 진입 다다음날로 되어 있어 다음날로 수정했습니다.
input: 매수금액1(10000000),매수금액2(10000000),지정일(20160525);
var : Ev(0),Xv(0),Xcond(false),Nday(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));
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 sdate == EntryDate and stime < 110000 and crossup(c,dayopen) Then
buy("bb",OnClose,def,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/3));
}
if MaxEntries >=1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition12 == false Then
exitlong("BL3",AtStop,AvgEntryPrice*0.96);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,AvgEntryPrice*1.20);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.95);
}
if Nday >= Nday[BarsSinceEntry]+1 and stime == 144500 Then
exitlong("bx");
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}
즐거운 하루되세요
> 깜피 님이 쓴 글입니다.
> 제목 : 수식 변경 요청
> 만들어 주신 수식을 잘 사용하고 있습니다.
과거에 하락시 분할 매수하는 형태로 컨셉을 잡았었는데,
하락 후 돌파시 추가 매수하는 형태로 수식을 변경해보고 싶습니다.
예를 들어 최초 매수(보통 첫번째 봉 종가 등)에서 매수 한 후에,
주가가 당일 시가 이하로 하락했다가 시가 회복시 추가 매수하고 해서
당일에 총 2회만 매수하고 싶습니다.
장이 루즈해질 경우도 있으므로 당일 11시까지 시가 회복을 못하면 2차분은 매수하지 않는 걸로 하구요.
당일에 1차분만 매수 조건이 나오고 익일에 추가 매수 조건이 나온다고 해도
익일에는 매수 진입을 하지 않고, 청산 조건을 충족하지 못해도 익일에는 매수 진입은 안하려고 합니다.(기존 수식은 익일에 조건 만족시 매수 진입됩니다)
그리고
if Nday > Nday[BarsSinceEntry]+1 and stime == 144500 Then
exitlong("bx");
익일 청산인데 상기 부분에서 익일 청산이 안되고 있는데, 확인 부탁드리겠습니다.
항상 감사드립니다.
------------------------------------------------------------------------------------
input: 매수금액1(10000000),매수금액2(10000000),지정일(20160525);
var : Ev(0),Xv(0),Xcond(false),Nday(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));
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
MaxContracts == CurrentContracts Then
buy("bb",Atlimit,EntryPrice*0.98,Floor(매수금액2/C));
if CurrentContracts > CurrentContracts[1] Then{
Ev = AvgEntryPrice;
Xv = Floor(MaxContracts*(1/3));
}
if MaxEntries >=1 Then{
if Condition11 == false Then
exitlong("BL1",AtStop,AvgEntryPrice*0.97,"",xv,1);
if Condition12 == false Then
exitlong("BL3",AtStop,AvgEntryPrice*0.96);
if Condition21 == false Then
exitlong("BP1",AtLimit,AvgEntryPrice*1.05,"",xv,1);
if Condition22 == false Then
exitlong("BP2",AtLimit,AvgEntryPrice*1.10,"",xv,1);
if Condition23 == false Then
exitlong("BP3",AtLimit,AvgEntryPrice*1.20);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)*0.95);
}
if Nday > Nday[BarsSinceEntry]+1 and stime == 144500 Then
exitlong("bx");
}
else{
Condition11 = false;
Condition12 = false;
Condition21 = false;
Condition22 = false;
Condition23 = false;
}
다음글
이전글