커뮤니티
문의드립니다
2019-01-16 10:12:25
187
글번호 125317
아래 전략에서
매수 진입은 첫번째 바로전 진입 신호 보다 높은때 매수 신호
매도 진입은 첫번째 바로전 진입 신호 보다 낮은때 매도 신호
이렇게 해주시면 되는데 바로 전 청산신호 부터 20봉안에서만 이렇게 하고
20봉이 넘어가면 상관없게 수정 부탁드립니다
INPUT : LENGTH(10),익절틱수(30),손절틱수(30);
VAR : TCHAN(0), BCHAN(0);
input : starttime(93000),endtime(010500);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
#상단
TCHAN = HIGHEST(HIGH, LENGTH)[1];
#하단
BCHAN = LOWEST(LOW, LENGTH)[1];
#10지수이평이 60지수이평보다 크면
#다음봉에 하단 이하의 시세가 발생하면 즉시 매수진입
if Tcond == TRUE AND
ema(C,5) > ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) Then
buy("buy", atlimit, BCHAN);
#매수진입 후
if MarketPosition == 1 Then
{
#상단까지 시세 상승하면 즉시 청산
exitlong("EL_상단터치", atlimit, TCHAN);
#30틱 수익이면 즉시 청산
exitlong("EL_익절",atlimit, EntryPrice + PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitlong("EL_손절",AtStop, EntryPrice - PriceScale*손절틱수);
}
#10지수이평이 60지수이평보다 작으면
#다음봉에 상단 이상의 시세가 발생하면 즉시 매도진입
if Tcond == true and
ema(C,5) < ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) Then
sell("sell", atlimit, TCHAN);
#매도진입 후
if MarketPosition == -1 Then
{
#하단까지 시세 하락하면 즉시 청산
exitshort("ES_하단터치", atlimit, BCHAN);
#30틱 수익이면 즉시 청산
exitshort("ES_익절",atlimit, EntryPrice - PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitshort("ES_손절",AtStop, EntryPrice + PriceScale*손절틱수);
}
답변 1
예스스탁 예스스탁 답변
2019-01-16 14:22:17
안녕하세요
예스스탁입니다.
INPUT : LENGTH(10),익절틱수(30),손절틱수(30);
VAR : TCHAN(0), BCHAN(0);
input : starttime(93000),endtime(010500);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
#상단
TCHAN = HIGHEST(HIGH, LENGTH)[1];
#하단
BCHAN = LOWEST(LOW, LENGTH)[1];
#10지수이평이 60지수이평보다 크면
#다음봉에 하단 이하의 시세가 발생하면 즉시 매수진입
if Tcond == TRUE AND
ema(C,5) > ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) and
(BarsSinceExit(1) >= 20 or (BarsSinceExit(1) < 20 and (min(NextBarOpen, BCHAN) > EntryPrice(1)) or EntryPrice(1) == 0)) then
buy("buy", atlimit, BCHAN);
#매수진입 후
if MarketPosition == 1 Then
{
#상단까지 시세 상승하면 즉시 청산
exitlong("EL_상단터치", atlimit, TCHAN);
#30틱 수익이면 즉시 청산
exitlong("EL_익절",atlimit, EntryPrice + PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitlong("EL_손절",AtStop, EntryPrice - PriceScale*손절틱수);
}
#10지수이평이 60지수이평보다 작으면
#다음봉에 상단 이상의 시세가 발생하면 즉시 매도진입
if Tcond == true and
ema(C,5) < ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) and
(BarsSinceExit(1) >= 20 or (BarsSinceExit(1) < 20 and (max(NextBarOpen, TCHAN) < EntryPrice(1)) or EntryPrice(1) == 0)) then
sell("sell", atlimit, TCHAN);
#매도진입 후
if MarketPosition == -1 Then
{
#하단까지 시세 하락하면 즉시 청산
exitshort("ES_하단터치", atlimit, BCHAN);
#30틱 수익이면 즉시 청산
exitshort("ES_익절",atlimit, EntryPrice - PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitshort("ES_손절",AtStop, EntryPrice + PriceScale*손절틱수);
}
즐거운 하루되세요
> 해피슈 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 아래 전략에서
매수 진입은 첫번째 바로전 진입 신호 보다 높은때 매수 신호
매도 진입은 첫번째 바로전 진입 신호 보다 낮은때 매도 신호
이렇게 해주시면 되는데 바로 전 청산신호 부터 20봉안에서만 이렇게 하고
20봉이 넘어가면 상관없게 수정 부탁드립니다
INPUT : LENGTH(10),익절틱수(30),손절틱수(30);
VAR : TCHAN(0), BCHAN(0);
input : starttime(93000),endtime(010500);
var : Tcond(false);
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
#상단
TCHAN = HIGHEST(HIGH, LENGTH)[1];
#하단
BCHAN = LOWEST(LOW, LENGTH)[1];
#10지수이평이 60지수이평보다 크면
#다음봉에 하단 이하의 시세가 발생하면 즉시 매수진입
if Tcond == TRUE AND
ema(C,5) > ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) Then
buy("buy", atlimit, BCHAN);
#매수진입 후
if MarketPosition == 1 Then
{
#상단까지 시세 상승하면 즉시 청산
exitlong("EL_상단터치", atlimit, TCHAN);
#30틱 수익이면 즉시 청산
exitlong("EL_익절",atlimit, EntryPrice + PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitlong("EL_손절",AtStop, EntryPrice - PriceScale*손절틱수);
}
#10지수이평이 60지수이평보다 작으면
#다음봉에 상단 이상의 시세가 발생하면 즉시 매도진입
if Tcond == true and
ema(C,5) < ema(C, 60) and
MarketPosition == 0 and (TotalTrades == 0 or (TotalTrades >= 1 and BarsSinceExit(1) >= 5)) Then
sell("sell", atlimit, TCHAN);
#매도진입 후
if MarketPosition == -1 Then
{
#하단까지 시세 하락하면 즉시 청산
exitshort("ES_하단터치", atlimit, BCHAN);
#30틱 수익이면 즉시 청산
exitshort("ES_익절",atlimit, EntryPrice - PriceScale*익절틱수);
#30틱 손실이면 즉시 청산
exitshort("ES_손절",AtStop, EntryPrice + PriceScale*손절틱수);
}
다음글