예스스탁
예스스탁 답변
2011-12-22 15:22:52
안녕하세요
예스스탁입니다.
input : 하루이익1(2);
var : PLR(0),XCommission(0,data1),XSlippage(0,data1),OpenPL(0,data1),dayPL(0,data1),count(0,data1),aa(0,data1);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1),mav4(0,data1),cond(false,data1);
var : bcond1(false,data1),B1idx(0,data1),bcond2(false,data1),B2idx(0,data1);
var : Scond1(false,data1),S1idx(0,data1),Scond2(false,data1),S2idx(0,data1);
var : d2Y(0,data2),d3Y(0,data3),D4Y(0,data4),Bxcond1(false,data1),Bxidx(0,data1);
var : d2E(0,data2),d3E(0,data3),D4E(0,data4),Sxcond1(false,data1),Sxidx(0,data1);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for aa = 0 to 10{
if sdate == EntryDate(aa) Then
count = count+1;
if aa > 0 and sdate == EntryDate(aa) Then
PLR = PLR+PositionProfit(aa);
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
cond = ExitDate(1) == sdate and
(IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("SP2",1) or IsExitName("bxxx",1) or IsExitName("Sxxx",1));
mav1 = data1(ma(c,5));
mav2 = data1(ma(c,10));
mav3 = data1(ma(c,20));
mav4 = data1(ma(c,60));
if data1(dayindex+1 >= 1 and dayindex+1 <= 30) and count < 3 and cond == false then{
if C < dayopen*1.004 And C > max(mav1,mav2,mav3,mav4) Then{
if data2(iff(C>O or (C==O and C>=C[1]),1,0))+
data3(iff(C>O or (C==O and C>=C[1]),1,0))+
data4(iff(C>O or (C==O and C>=C[1]),1,0)) >= 2 Then
buy("b2_1");
}
if C > dayopen*0.996 And C < Min(mav1,mav2,mav3,mav4) Then{
if data2(iff(C<O or (C==O and C<C[1]),1,0))+
data3(iff(C<O or (C==O and C<C[1]),1,0))+
data4(iff(C<O or (C==O and C<C[1]),1,0)) >= 2 Then
Sell("s2_1");
}
}
If MarketPosition == 1 Then{
if data1(dayindex+1) >= 40 and C < mav2 Then
ExitLong("bx4");
}
If MarketPosition == -1 Then{
if data1(dayindex+1) >= 40 and C > mav2 Then
ExitShort("sx4");
}
if MarketPosition == 1 Then{
if data1(dayindex+1 >= 20) Then
ExitLong("BP2",AtLimit,EntryPrice+((하루이익1)-(PLR)));
}
if MarketPosition == -1 Then{
if data1(dayindex+1 >= 20) Then
ExitShort("SP2",AtLimit,EntryPrice+(-(하루이익1)+(PLR)));
}
if data1(dayindex+1 == 1) Then
Bcond1 = false;
if data2(dayindex ==0) Then
d2Y = 0;
if data2(dayindex+1 == 3 and countif(C<O,3)==3) or data2(dayindex+1 > 3 and !(C[4] < O[4]) and countif(C<O,3)==3) Then
d2Y = d2Y+1;
if data2(dayindex+1 == 3 and countif(C>O,3)==3) or data2(dayindex+1 > 3 and !(C[4] > O[4]) and countif(C>O,3)==3) Then
d2E = d2E+1;
if data3(dayindex ==0) Then
d3Y = 0;
if data3(dayindex+1 == 3 and countif(C< O,3)==3) or data3(dayindex+1 > 3 and !(C[4] < O[4]) and countif(C<O,3)==3) Then
d3Y = d3Y+1;
if data3(dayindex+1 == 3 and countif(C>O,3)==3) or data3(dayindex+1 > 3 and !(C[4] > O[4]) and countif(C>O,3)==3) Then
d3E = d3E+1;
if data4(dayindex ==0) Then
d4Y = 0;
if data4(dayindex+1 == 3 and countif(C< O,3)==3) or data4(dayindex+1 > 3 and !(C[4] < O[4]) and countif(C<O,3)==3) Then
d4E = d4E+1;
if data4(dayindex+1 == 3 and countif(C>O,3)==3) or data4(dayindex+1 > 3 and !(C[4] > O[4]) and countif(C>O,3)==3) Then
d4Y = d4Y+1;
if data1(dayindex+1 >= 7 and dayindex+1 <= 33) and cond == false Then{
if data8(countif(c<O,3) == 3) and data9(countif(C>O,3) == 3) and data10(countif(C>O,3)== 3) And
data2(iff(C>O,1,0))+data3(iff(C>O,1,0))+data4(iff(C>O,1,0)) >= 1 and D2E < 2 and D3E < 2 and D4E < 2 Then{
Bcond1 = true;
B1idx = data1(index);
}
if Bcond1 == true and data1(index) <= B1idx+7 and data1(C> ma(c,5)) Then
buy();
if (MarketPosition == 0 or (MarketPosition == -1 and data1(lowest(L,BarsSinceEntry) <= EntryPrice*0.989))) And
data8(countif(C<O,3)== 3) and data9(countif(C>O,3))+data10(countif(C>O,3)) >= 4 And
D2E < 2 and D3E < 2 and D4E < 2 and
((data2(C>O) and data3(C>O) and data4(C>O)) or data2(countif(C>O,3)== 3) or data3(countif(C>O,3)== 3) or data4(countif(C>O,3)== 3)) Then{
Bcond2 = true;
B2idx = data1(index);
}
if Bcond2 == true and data1(index) <= B2idx+7 and data1(C> ma(c,5)) Then
buy();
}
if MarketPosition == 1 and C >= EntryPrice*1.0085 and C > dayopen*1.005 then{
if data8(iff(C>OpenD(0),1,0))+data9(iff(C<OpenD(0),1,0)) and data10(iff(C<OpenD(0),1,0)) and data7(iff(C<OpenD(0),1,0))+data11(iff(C<OpenD(0),1,0)) >= 2 Then{
BXcond1 = true;
Bxidx = data1(index);
}
if Bxcond1 == true and data1(index) <= Bxidx+7 and data1(C< ma(c,5)) Then
exitlong("bxxx");
}
if MarketPosition != 1 Then
Bxcond1 = false;
if data1(dayindex+1 >= 7 and dayindex+1 <= 33) and cond == false Then{
if data8(countif(c>O,3) == 3) and data9(countif(C<O,3) == 3) and data10(countif(C<O,3)== 3) And
data2(iff(C<O,1,0))+data3(iff(C<O,1,0))+data4(iff(C<O,1,0)) >= 1 and D2Y < 2 and D3Y < 2 and D4Y < 2 Then{
Scond1 = true;
S1idx = data1(index);
}
if Scond1 == true and data1(index) <= B1idx+7 and data1(C<ma(c,5)) Then
Sell();
if (MarketPosition == 0 or (MarketPosition == 1 and data1(highest(H,BarsSinceEntry) >= EntryPrice*1.011))) And
data8(countif(C>O,3)== 3) and data9(countif(C<O,3))+data10(countif(C<O,3)) >= 4 And
D2Y < 2 and D3Y < 2 and D4Y < 2 and
((data2(C<O) and data3(C<O) and data4(C<O)) or data2(countif(C<O,3)== 3) or data3(countif(C<O,3)== 3) or data4(countif(C<O,3)== 3)) Then{
Scond2 = true;
S2idx = data1(index);
}
if Scond2 == true and data1(index) <= B2idx+7 and data1(C<ma(c,5)) Then
Sell();
}
if MarketPosition == -1 and C <= EntryPrice*0.9915 and C < dayopen*0.9955 then{
if data8(iff(C<OpenD(0),1,0))+data9(iff(C>OpenD(0),1,0)) and data10(iff(C>OpenD(0),1,0)) and data7(iff(C>OpenD(0),1,0))+data11(iff(C>OpenD(0),1,0)) >= 2 Then{
SXcond1 = true;
Sxidx = data1(index);
}
if Sxcond1 == true and data1(index) <= Bxidx+10 and data1(C>ma(c,5)) Then
ExitShort("Sxxx");
}
if MarketPosition != -1 Then
Sxcond1 = false;
즐거운 하루되세요
> 강태공3 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다.
> <html>
<head>
<title>안녕하세요</title>
<meta name="generator" content="Namo WebEditor v4.0">
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
안녕하세요.
<p>아래 수식에 덧붙여서 수정부탁드립니다.</p>
<p> </p>
<p><font color="blue">아래 매수 매도 진입조건은 금일 진입횟수 제한에서는 제외</font></p>
<p><b><font color="red">매수진입 및 청산조건</font></b></p>
<p><font color="black">1. 금일 7번째봉부터~33봉까지</font></p>
<p><font color="black"> (1) 데이타8 이 연속 3봉이 음봉이고 데이타9.10이 연속 3봉이 양봉이고
데이타2,3,4 중에 양봉이 1개이상(단 데이타2,3,4 중에 3봉연속 음봉이 2개이상이면
안됨)</font></p>
<p><font color="black"> 이면 그 이후에 7봉이내에 선물이 5이평보다
크면 매수 </font></p>
<p><font color="black"> (2) (현재 무포이거나 or 매도후 최고 수익이 진입가대비 1.1%이상이고)
and 데이타8 이 연속 3봉이 음봉이고 데이타9.10이 3봉동안 양봉이 총</font><font color="black">4</font><font color="black">개이고
</font></p>
<p> (단 데이타2,3,4 중에 3봉연속 음봉이
2개이상이면 안됨) and (데이타2,3,4,가 모두 양봉이거나
or 데이타2,3,4 중에서 3봉연속 양봉이 1개이상이면) </p>
<p> 그 이후에 7봉이내에 선물이
5이평보다 크면 매수</p>
<p>2. 금일 3봉부터 31봉까지는 </p>
<p> 매수후 현재 수익이 종가로 진입가 대비 0.85% 이상이고
현재 종가가 시초가*1.005 보다 크고 (데이타8이 시초가보다 크다+ 데이타9가 시초가보다
작다+</p>
<p> 데이타10 이 시초가보다 작다+ 데이타7이 시초가보다
작다+ 데이타11이 시초가보다 작다= 이렇게 5조건중에 2개이상 만족하면 ) 그 이후
10봉이내에</p>
<p> c가 5이평보다 작으면 청산후
<font color="red">금일 모든매매종료</font></p>
<p> </p>
<p> </p>
<p><b><font color="blue">매도진입 및 청산조건</font></b></p>
<p><font color="black">1. 금일 7번째봉부터~33봉까지</font></p>
<p><font color="black"> (1) 데이타8 이 연속 3봉이 양봉이고 데이타9.10이 연속 3봉이
음봉이고 데이타2,3,4 중에 음봉이 1개이상(단 데이타2,3,4 중에 3봉연속 양봉이
2개이상이면 안됨)이면</font></p>
<p><font color="black"> 그 이후에 7봉이내에 선물이 5이평보다
작으면 매도</font></p>
<p><font color="black"> (2) (현재 무포이거나 or 매수후 최고 수익이 진입가대비 1.1%이상이고)
and 데이타8 이 연속 3봉이 양봉이고 데이타9.10이 3봉동안 음봉이 총</font><font color="black">4</font><font color="black">개이고</font></p>
<p><font color="black"> (단 데이타2,3,4 중에
3봉연속 양봉이 2개이상이면 안됨) and (데이타2,3,4,가 모두 음봉이거나
or 데이타2,3,4 중에서 3봉연속 음봉이 1개이상이면) </font></p>
<p><font color="black"> 그 이후에 7봉이내에 선물이
5이평보다 작으면 매도</font></p>
<p><font color="black">2. 금일 3봉부터 31봉까지는 </font></p>
<p> 매도후 현재 수익이 종가로 진입가 대비 0.85% 이상이고
현재 종가가 시초가*0.9955 보다 작고 (데이타8이 시초가보다 작다+ 데이타9가 시초가보다
크다+</p>
<p> 데이타10 이 시초가보다 크다+ 데이타7이 시초가보다
크다+ 데이타11이 시초가보다 크다= 이렇게 5조건중에 2개이상 만족하면 ) 그 이후
10봉이내에 c가 5이평보다</p>
<p> 크면 청산후
<font color="red">금일 모든매매종료</font></p>
<p> </p>
<p><BR><BR>input : 하루이익1(3),하루이익2(4);<BR>var : PLR(0),XCommission(0,data1),XSlippage(0,data1),OpenPL(0,data1),dayPL(0,data1),count(0,data1),aa(0,data1); <BR>var : mav1(0,data1),mav2(0,data1),mav3(0,data1),mav4(0,data1),cond(false,data1);<BR><BR>#당일누적손익계산 시작<BR>XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정<BR>XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정<BR><BR>PLR = 0;<BR>count = 0;<BR>for aa = 0 to 10{<BR> if sdate == EntryDate(aa) Then<BR> count = count+1;<BR> if aa > 0 and sdate == EntryDate(aa) Then<BR> PLR = PLR+PositionProfit(aa);<BR>}<BR><BR>if MarketPosition() == 0 Then{<BR> OpenPL = 0;<BR> dayPL = PLR;<BR>}<BR>Else{<BR> OpenPL = (PositionProfit-(XCommission+XSlippage));<BR> dayPL = PLR+OpenPL;<BR>}<BR><BR><BR>cond = ExitDate(1) == sdate and (IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("SP2",1));<BR><BR>mav1 = data1(ma(c,5));<BR>mav2 = data1(ma(c,10));<BR>mav3 = data1(ma(c,20));<BR>mav4 = data1(ma(c,60));<BR><BR><BR>if data1(dayindex+1 >= 1 and dayindex+1 <= 30) and count < 3 and cond == false then{<BR> if C < dayopen*1.004 And C > max(mav1,mav2,mav3,mav4) Then{<BR> if data2(iff(C>O or (C==O and C>=C[1]),1,0))+<BR> data3(iff(C>O or (C==O and C>=C[1]),1,0))+<BR> data4(iff(C>O or (C==O and C>=C[1]),1,0))+<BR> data5(iff(C>O or (C==O and C>=C[1]),1,0))+<BR> data6(iff(C>O or (C==O and C>=C[1]),1,0))+<BR> data7(iff(C>O or (C==O and C>=C[1]),1,0)) >= 4 Then<BR> buy("b2_1");<BR><BR> }<BR> if C > dayopen*0.996 And C < Min(mav1,mav2,mav3,mav4) Then{<BR> if data2(iff(C<O or (C==O and C<C[1]),1,0))+<BR> data3(iff(C<O or (C==O and C<C[1]),1,0))+<BR> data4(iff(C<O or (C==O and C<C[1]),1,0))+<BR> data5(iff(C<O or (C==O and C<C[1]),1,0))+<BR> data6(iff(C<O or (C==O and C<C[1]),1,0))+<BR> data7(iff(C<O or (C==O and C<C[1]),1,0)) >= 4 Then<BR> Sell("s2_1");<BR><BR> }<BR><BR><BR>If MarketPosition == 1 Then{<BR> if data1(dayindex+1) >= 40 and C < mav2 Then<BR> exitlong("bx4");<BR>}<BR><BR>If MarketPosition == -1 Then{<BR> if data1(dayindex+1) >= 40 and C > mav2 Then<BR> ExitShort("sx4");<BR>}<BR><BR><BR>if MarketPosition == 1 Then{<BR> if data1(dayindex+1 < 20) Then<BR> ExitLong("BP1",AtLimit,EntryPrice+((하루이익1)-(PLR)));<BR> if data1(dayindex+1 >= 20) Then<BR> ExitLong("BP2",AtLimit,EntryPrice+((하루이익2)-(PLR)));<BR>}<BR><BR>if MarketPosition == -1 Then{<BR> if data1(dayindex+1 < 20) Then <BR> ExitShort("SP1",AtLimit,EntryPrice+(-(하루이익1)+(PLR)));<BR> if data1(dayindex+1 >= 20) Then<BR> ExitShort("SP2",AtLimit,EntryPrice+(-(하루이익2)+(PLR)));<BR>}<BR></p>
</body>
</html>