커뮤니티
문의드립니다
2019-01-16 14:56:37
181
글번호 125334
아래 수식에서 시간 삭제해서 수정 부탁드립니다
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*손절틱수);
}
답변 1
예스스탁 예스스탁 답변
2019-01-17 10:14:46
안녕하세요
예스스탁입니다.
INPUT : LENGTH(10),익절틱수(30),손절틱수(30);
VAR : TCHAN(0), BCHAN(0);
#상단
TCHAN = HIGHEST(HIGH, LENGTH)[1];
#하단
BCHAN = LOWEST(LOW, LENGTH)[1];
#10지수이평이 60지수이평보다 크면
#다음봉에 하단 이하의 시세가 발생하면 즉시 매수진입
if 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 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*손절틱수);
}
즐거운 하루되세요
> 해피슈 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 아래 수식에서 시간 삭제해서 수정 부탁드립니다
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*손절틱수);
}