커뮤니티
수식 문의드립니다.
2016-06-09 08:00:03
101
글번호 98880
고민은 하다가 익익영업일에 일괄 청산하는 걸로 최종세팅을 했고,
기존에 주셨던 부분이 잘 안먹히는 경우가 있어서 임의로 수정을 했습니다.(휴일이 있을 때마다 수정을 해줘야하는 단점이 있네요 ㅠ)
그리고 시가 돌파시 재진입 부분에서 안정적으로 진입하기 위해서
"최초 진입 이후 시가 대비 2% 이상 하락 후 상승하여 시가 돌파"로 수정을 하고 싶습니다.
input: 매수금액1(3000000),매수금액2(3000000),지정일(20160609);
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("BP33",AtLimit,CloseD(1)*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",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-09 14:56:41
안녕하세요
예스스탁입니다.
input: 매수금액1(3000000),매수금액2(3000000),지정일(20160609);
var : Ev(0),Xv(0),Xcond(false),Nday(0),LL(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 CurrentContracts > CurrentContracts[1] Then
LL = L;
if L < LL Then
LL = L;
if sdate == EntryDate and stime < 110000 and crossup(c,dayopen) and LL < dayopen*0.98 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("BP33",AtLimit,CloseD(1)*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",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;
}
즐거운 하루되세요
> 깜피 님이 쓴 글입니다.
> 제목 : 수식 문의드립니다.
>
고민은 하다가 익익영업일에 일괄 청산하는 걸로 최종세팅을 했고,
기존에 주셨던 부분이 잘 안먹히는 경우가 있어서 임의로 수정을 했습니다.(휴일이 있을 때마다 수정을 해줘야하는 단점이 있네요 ㅠ)
그리고 시가 돌파시 재진입 부분에서 안정적으로 진입하기 위해서
"최초 진입 이후 시가 대비 2% 이상 하락 후 상승하여 시가 돌파"로 수정을 하고 싶습니다.
input: 매수금액1(3000000),매수금액2(3000000),지정일(20160609);
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("BP33",AtLimit,CloseD(1)*1.28);
if MaxEntries == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 Then
ExitLong("btr",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;
}
다음글
이전글