커뮤니티
수정부탁드립니다.
2017-09-28 20:53:53
164
글번호 113179
적용해본 결과
제가원한것이아니라서ㅎ
목표틱수 를 다했을경우
매매 신호 금지 를 원합니다
예시: 익절틱수 30틱 을 설정 했으면
수익이 30틱이다 그러면
더이상 신호발생 금지(청산)
다시 한번 부탁드립니다
현제 밑에 수식은
익절틱수만 설정이되서
원하는 수익을 얻었을경우
또 신호가 나오기때문입니다
input : P(10),익절틱수(10);
Input : 시작시간(103000),종료시간(170000);
Var : Xcond(false),MM(0),T(0),Tcond(false),idx(0);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Xcond = false;
idx = 0;
}
if (sdate != sdate[1] and stime >= 종료시간) or
(sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true then
Xcond = true;
MM = (highest(H,P)+lowest(L,P))/2;
if Tcond == true then{
idx = idx+1;
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
if idx == 1 and T == 1 then
buy();
if idx == 1 and T == -1 then
sell();
if idx > 1 then{
if T == 1 and T[1] != 1 Then
buy();
if T == 0 and T[1] == 1 Then
sell();
}
if T == -1 and T[1] != -1 Then
sell();
if T == 0 and T[1] == -1 Then
buy();
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
답변 1
예스스탁 예스스탁 답변
2017-09-29 11:15:28
안녕하세요
예스스탁입니다.
식을 수정했습니다.
1번식은 당일 SetStopProfittarget으로 청산이 발생하면
이후에는 더이상 진입하지 않는 식입니다.
2번식은 당일 지정한 당일합산수익이 지정한 값에 도달하면
청산 후 더이상 진입하지 않는 식입니다.
1번
input : P(10),익절틱수(10);
Input : 시작시간(103000),종료시간(170000);
Var : Xcond(false),MM(0),T(0),Tcond(false),idx(0);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Xcond = false;
idx = 0;
}
if (sdate != sdate[1] and stime >= 종료시간) or
(sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true then
Xcond = true;
MM = (highest(H,P)+lowest(L,P))/2;
if Tcond == true and Xcond == false then{
idx = idx+1;
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
if idx == 1 and T == 1 then
buy();
if idx == 1 and T == -1 then
sell();
if idx > 1 then{
if T == 1 and T[1] != 1 Then
buy();
if T == 0 and T[1] == 1 Then
sell();
}
if T == -1 and T[1] != -1 Then
sell();
if T == 0 and T[1] == -1 Then
buy();
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
2번
input : P(10),익절틱수(10);
Input : 시작시간(103000),종료시간(170000);
Input : 당일수익틱수(30);
Var : Xcond(false),MM(0),T(0),Tcond(false),idx(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0);
당일수익 = PriceScale*당일수익틱수;
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Xcond = false;
idx = 0;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if (sdate != sdate[1] and stime >= 종료시간) or
(sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] and
(IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
MM = (highest(H,P)+lowest(L,P))/2;
if Tcond == true and Xcond == false then{
idx = idx+1;
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
if idx == 1 and T == 1 then
buy();
if idx == 1 and T == -1 then
sell();
if idx > 1 then{
if T == 1 and T[1] != 1 Then
buy();
if T == 0 and T[1] == 1 Then
sell();
}
if T == -1 and T[1] != -1 Then
sell();
if T == 0 and T[1] == -1 Then
buy();
if MarketPosition == 1 then
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
if MarketPosition == -1 then
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
즐거운 하루되세요
> 곽민수 님이 쓴 글입니다.
> 제목 : 수정부탁드립니다.
> 적용해본 결과
제가원한것이아니라서ㅎ
목표틱수 를 다했을경우
매매 신호 금지 를 원합니다
예시: 익절틱수 30틱 을 설정 했으면
수익이 30틱이다 그러면
더이상 신호발생 금지(청산)
다시 한번 부탁드립니다
현제 밑에 수식은
익절틱수만 설정이되서
원하는 수익을 얻었을경우
또 신호가 나오기때문입니다
input : P(10),익절틱수(10);
Input : 시작시간(103000),종료시간(170000);
Var : Xcond(false),MM(0),T(0),Tcond(false),idx(0);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Xcond = false;
idx = 0;
}
if (sdate != sdate[1] and stime >= 종료시간) or
(sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true then
Xcond = true;
MM = (highest(H,P)+lowest(L,P))/2;
if Tcond == true then{
idx = idx+1;
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
if idx == 1 and T == 1 then
buy();
if idx == 1 and T == -1 then
sell();
if idx > 1 then{
if T == 1 and T[1] != 1 Then
buy();
if T == 0 and T[1] == 1 Then
sell();
}
if T == -1 and T[1] != -1 Then
sell();
if T == 0 and T[1] == -1 Then
buy();
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
다음글
이전글