예스스탁
예스스탁 답변
2021-01-18 11:07:16
안녕하세요
예스스탁입니다.
120개봉 최고가 갱신으로 작성해 드립니다.
Input : 투자금액(10000000),Period(120),N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),Hv(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
Hv = Highest(H,Period);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then
{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then
{
if MarketPosition == 0 and count < N and CrossUp(c,Hv[1]) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}
}
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 전고점 돌파 매매
> 제가 쓰는 수식을 바탕으로 전고점 돌파매매로 변환해 보고싶습니다.
매수는 전고점 돌파시마다 5차매수까지 진행, 동일비율로 진입합니다.
그리고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%,
4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정합니다.
수익실현은 따로 설정하지 않고, 손절시에는 처음부터 다시 1차매수로 진입하도록 하고 싶습니다. 전고점 확인봉 개수는 5분봉을 이용하고 첨부한 파일처럼.. 대략 120개 정도 되는거 같습니다. 이부분이 명확하지 않다면 일반적으로 전고점 확인하는 갯수로 지정해주셔도 됩니다.
아래는 제가 사용하는 수식입니다.
----------------
Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
WR = WILLR(WRP);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{
if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}}}
답변 감사합니다 ^^
그런데 손절에 관한 부분은 안된거 같은데.. 그것도 좀 부탁드려도 될까요.
5차매수까지 동일금액으로 매수를 진행하고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%, 4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 전고점 돌파 매매
> 안녕하세요
예스스탁입니다.
120개봉 최고가 갱신으로 작성해 드립니다.
Input : 투자금액(10000000),Period(120),N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),Hv(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
Hv = Highest(H,Period);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then
{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then
{
if MarketPosition == 0 and count < N and CrossUp(c,Hv[1]) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}
}
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 전고점 돌파 매매
> 제가 쓰는 수식을 바탕으로 전고점 돌파매매로 변환해 보고싶습니다.
매수는 전고점 돌파시마다 5차매수까지 진행, 동일비율로 진입합니다.
그리고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%,
4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정합니다.
수익실현은 따로 설정하지 않고, 손절시에는 처음부터 다시 1차매수로 진입하도록 하고 싶습니다. 전고점 확인봉 개수는 5분봉을 이용하고 첨부한 파일처럼.. 대략 120개 정도 되는거 같습니다. 이부분이 명확하지 않다면 일반적으로 전고점 확인하는 갯수로 지정해주셔도 됩니다.
아래는 제가 사용하는 수식입니다.
----------------
Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
WR = WILLR(WRP);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{
if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}}}
예스스탁
예스스탁 답변
2021-01-18 12:44:05
안녕하세요
예스스탁입니다.
Input : 투자금액(10000000),Period(120),N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),Hv(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
Hv = Highest(H,Period);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then
{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then
{
if MarketPosition == 0 and count < N and CrossUp(c,Hv[1]) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if MaxEntries == 1 Then
ExitLong("bl1",AtStop,AvgEntryPrice*0.95);
if MaxEntries == 2 Then
ExitLong("bl2",AtStop,AvgEntryPrice*0.975);
if MaxEntries == 3 Then
ExitLong("bl3",AtStop,AvgEntryPrice*0.983);
if MaxEntries == 4 Then
ExitLong("bl4",AtStop,AvgEntryPrice*0.9875);
if MaxEntries >= 5 Then
ExitLong("bl5",AtStop,AvgEntryPrice*0.90);
}
}
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : Re : Re : 전고점 돌파 매매
> 답변 감사합니다 ^^
그런데 손절에 관한 부분은 안된거 같은데.. 그것도 좀 부탁드려도 될까요.
5차매수까지 동일금액으로 매수를 진행하고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%, 4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 전고점 돌파 매매
> 안녕하세요
예스스탁입니다.
120개봉 최고가 갱신으로 작성해 드립니다.
Input : 투자금액(10000000),Period(120),N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),Hv(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
Hv = Highest(H,Period);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then
{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then
{
if MarketPosition == 0 and count < N and CrossUp(c,Hv[1]) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossUp(c,Hv[1]) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}
}
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 전고점 돌파 매매
> 제가 쓰는 수식을 바탕으로 전고점 돌파매매로 변환해 보고싶습니다.
매수는 전고점 돌파시마다 5차매수까지 진행, 동일비율로 진입합니다.
그리고 손절선을 1차매수시 -5%, 2차매수시 평균단가 -2.5%, 3차매수시 평균단가 -1.7%,
4차매수시 평균단가 -1.25%, 5차매수시 평균단가 -1.0%로 지정합니다.
수익실현은 따로 설정하지 않고, 손절시에는 처음부터 다시 1차매수로 진입하도록 하고 싶습니다. 전고점 확인봉 개수는 5분봉을 이용하고 첨부한 파일처럼.. 대략 120개 정도 되는거 같습니다. 이부분이 명확하지 않다면 일반적으로 전고점 확인하는 갯수로 지정해주셔도 됩니다.
아래는 제가 사용하는 수식입니다.
----------------
Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000);
Input : loss(5),P(3),WRP(10);
var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0);
var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false);
var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false);
Array : VV[6](0),XX[5](0);
BBup = BollBandUp(Period,MultiD);
BBdn = BollBandDown(Period,MultiD);
WR = WILLR(WRP);
Vma = ma(V,P);
vv[0] = floor((투자금액*0.1)/NextBarOpen);
vv[1] = floor((투자금액*0.1)/NextBarOpen);
vv[2] = floor((투자금액*0.1)/NextBarOpen);
vv[3] = floor((투자금액*0.2)/NextBarOpen);
vv[4] = floor((투자금액*0.2)/NextBarOpen);
vv[5] = floor((투자금액*0.3)/NextBarOpen);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if bdate != bdate[1] Then
count = 0;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true and NextBarStime <= 151000 then{
if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{
if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and
V >= Vma[1]*2.0 Then {
buy("b1",atmarket,def,vv[MaxEntries]);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then{
e = e +1;
if e == 1 then
XX[e] = CurrentContracts;
Else
XX[e] = CurrentContracts-CurrentContracts[1];
}
#두번째 매수
if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b2",atmarket,def,vv[MaxEntries]);
}
#세번재매수
if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b3",atmarket,def,vv[MaxEntries]);
}
#네번재매수
if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b4",atmarket,def,vv[MaxEntries]);
}
#다섯번재매수
if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*2.0 Then
{
buy("b5",atmarket,def,vv[MaxEntries]);
}
#여섯번재매수
if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and
V >= Vma[1]*3.0 Then
{
buy("b6",atmarket,def,vv[MaxEntries]);
}
HH = highest(H,BarsSinceEntry);
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then
Bxcond1 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then
Bxcond2 = true;
if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then
Bxcond3 = true;
if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then
ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1);
if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then
ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then
ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1);
}}}