커뮤니티
수식 문의
2018-07-24 11:31:35
140
글번호 120844
두가지 전략을 시간대별(02시~21시/21시~02시)로 나눠서 작성해주세요.
각 전략마다 익절, 손절로 청산되도록 해주세요.
각 전략의 신호들이 서로 영향을 받지 않도록 시간청산도 넣어세요.
A전략 : 조건1 만족 후 조건2 만족 후 진입조건만족 시 매수/매도
B전략 : 조건1 만족 후 진입조건 만족 시 매수/매도
답변 3
예스스탁 예스스탁 답변
2018-07-24 15:24:02
안녕하세요
예스스탁입니다.
input : 시작시간1(020000),끝시간1(210000),시작시간2(210000),끝시간2(020000);
var : TF(0),T(0);
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) then
{
TF = 1;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간1) or
(sdate == sdate[1] and stime >= 끝시간1 and stime[1] < 끝시간1) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == 1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) then
{
TF = 2;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간2) or
(sdate == sdate[1] and stime >= 끝시간2 and stime[1] < 끝시간2) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TF == 1 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수조건2 Then
T = 2;
if T == -1 and 매도조건2 Then
T = -2;
if T == 2 and 매수진입조건 Then
buy();
if T == -2 and 매도진입조건 Then
sell();
}
if TF == 2 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수진입조건 Then
buy();
if T == -1 and 매도진입조건 Then
sell();
}
즐거운 하루되세요
> mimi 님이 쓴 글입니다.
> 제목 : 수식 문의
> 두가지 전략을 시간대별(02시~21시/21시~02시)로 나눠서 작성해주세요.
각 전략마다 익절, 손절로 청산되도록 해주세요.
각 전략의 신호들이 서로 영향을 받지 않도록 시간청산도 넣어세요.
A전략 : 조건1 만족 후 조건2 만족 후 진입조건만족 시 매수/매도
B전략 : 조건1 만족 후 진입조건 만족 시 매수/매도
mimi
2018-07-25 00:33:14
TF = 1의 경우가 작동을 안합니다.
TF = 2 시간 수식을 지우면 신호들이 나오구요...
확인바랍니다.
또한 전략별로 손절수식과 익절수식도 부탁드려요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의
> 안녕하세요
예스스탁입니다.
input : 시작시간1(020000),끝시간1(210000),시작시간2(210000),끝시간2(020000);
var : TF(0),T(0);
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) then
{
TF = 1;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간1) or
(sdate == sdate[1] and stime >= 끝시간1 and stime[1] < 끝시간1) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == 1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) then
{
TF = 2;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간2) or
(sdate == sdate[1] and stime >= 끝시간2 and stime[1] < 끝시간2) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TF == 1 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수조건2 Then
T = 2;
if T == -1 and 매도조건2 Then
T = -2;
if T == 2 and 매수진입조건 Then
buy();
if T == -2 and 매도진입조건 Then
sell();
}
if TF == 2 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수진입조건 Then
buy();
if T == -1 and 매도진입조건 Then
sell();
}
즐거운 하루되세요
> mimi 님이 쓴 글입니다.
> 제목 : 수식 문의
> 두가지 전략을 시간대별(02시~21시/21시~02시)로 나눠서 작성해주세요.
각 전략마다 익절, 손절로 청산되도록 해주세요.
각 전략의 신호들이 서로 영향을 받지 않도록 시간청산도 넣어세요.
A전략 : 조건1 만족 후 조건2 만족 후 진입조건만족 시 매수/매도
B전략 : 조건1 만족 후 진입조건 만족 시 매수/매도
예스스탁 예스스탁 답변
2018-07-25 14:04:26
안녕하세요
예스스탁입니다.
수정한 식입니다.
input : 시작시간1(020000),끝시간1(210000),시작시간2(210000),끝시간2(020000);
var : TF(0),T(0);
if (sdate != sdate[1] and stime >= 끝시간1) or
(sdate == sdate[1] and stime >= 끝시간1 and stime[1] < 끝시간1) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == 1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 끝시간2) or
(sdate == sdate[1] and stime >= 끝시간2 and stime[1] < 끝시간2) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) then
{
TF = 1;
T = 0;
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) then
{
TF = 2;
T = 0;
}
if TF == 1 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수조건2 Then
T = 2;
if T == -1 and 매도조건2 Then
T = -2;
if T == 2 and 매수진입조건 Then
buy("b1");
if T == -2 and 매도진입조건 Then
sell("s1");
}
if TF == 2 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수진입조건 Then
buy();
if T == -1 and 매도진입조건 Then
sell();
}
if MarketPosition == 1 then
{
#1구간 진입 10틱손절, 10틱익절
if TF[BarsSinceEntry] == 1 then
{
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*10);
ExitLong("bl1",AtStop,EntryPrice-PriceScale*10);
}
#2구간진입 20틱손절, 20틱익절
if TF[BarsSinceEntry] == 2 then
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*20);
ExitLong("bl2",AtStop,EntryPrice-PriceScale*20);
}
}
if MarketPosition == -1 then
{
#1구간 진입 10틱손절, 10틱익절
if TF[BarsSinceEntry] == 1 then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*10);
ExitShort("sl1",AtStop,EntryPrice+PriceScale*10);
}
#2구간진입 20틱손절, 20틱익절
if TF[BarsSinceEntry] == 2 then
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*20);
ExitShort("sl2",AtStop,EntryPrice+PriceScale*20);
}
}
즐거운 하루되세요
> mimi 님이 쓴 글입니다.
> 제목 : Re : Re : 수식 문의
> TF = 1의 경우가 작동을 안합니다.
TF = 2 시간 수식을 지우면 신호들이 나오구요...
확인바랍니다.
또한 전략별로 손절수식과 익절수식도 부탁드려요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의
> 안녕하세요
예스스탁입니다.
input : 시작시간1(020000),끝시간1(210000),시작시간2(210000),끝시간2(020000);
var : TF(0),T(0);
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) then
{
TF = 1;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간1) or
(sdate == sdate[1] and stime >= 끝시간1 and stime[1] < 끝시간1) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == 1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) then
{
TF = 2;
T = 0;
}
if (sdate != sdate[1] and stime >= 끝시간2) or
(sdate == sdate[1] and stime >= 끝시간2 and stime[1] < 끝시간2) then
{
TF = 0;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TF == 1 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수조건2 Then
T = 2;
if T == -1 and 매도조건2 Then
T = -2;
if T == 2 and 매수진입조건 Then
buy();
if T == -2 and 매도진입조건 Then
sell();
}
if TF == 2 then
{
if 매수조건1 Then
T = 1;
if 매도조건1 Then
T = -1;
if T == 1 and 매수진입조건 Then
buy();
if T == -1 and 매도진입조건 Then
sell();
}
즐거운 하루되세요
> mimi 님이 쓴 글입니다.
> 제목 : 수식 문의
> 두가지 전략을 시간대별(02시~21시/21시~02시)로 나눠서 작성해주세요.
각 전략마다 익절, 손절로 청산되도록 해주세요.
각 전략의 신호들이 서로 영향을 받지 않도록 시간청산도 넣어세요.
A전략 : 조건1 만족 후 조건2 만족 후 진입조건만족 시 매수/매도
B전략 : 조건1 만족 후 진입조건 만족 시 매수/매도