예스스탁
예스스탁 답변
2020-05-18 16:32:42
안녕하세요
예스스탁입니다.
1
매도포지션을 청산하는 함수는 exitshort입니다.
매수포지션 청산함수(exitlong)가 사용되어
매도익,매도본, 매도손 신호가 나오지 않았습니다.
Input : 거래시작날짜(20200514), 거래시작시간(230000);
Inputs: 매도진입(8910.50), 매도익절(8870), 매도손절(8987);
Vars: Tcond(false);
if sdate == 거래시작날짜 and
((sdate != sdate[1] and stime >= 거래시작시간) or
(sdate == sdate[1] and stime >= 거래시작시간 and stime[1] < 거래시작시간)) Then
{
Tcond = true;
}
if Tcond == true then
{
#매도조건#
If C < 매도진입
and (C[1] > 매도진입 or C[2] > 매도진입 or C[3] > 매도진입 or C[4] > 매도진입)
and MarketPosition == 0
Then Sell("매도", AtLimit, 매도진입,2);
If IsEntryName("매도") Then
{
If currentcontracts == maxcontracts Then
{
If C < EntryPrice Then
ExitShort("매도익", AtLimit,매도익절,"",1,1);
If C > EntryPrice Then
ExitShort("매도본", AtLimit, 매도진입);
ExitShort("매도손", AtStop, 매도손절);
}
If currentcontracts < maxcontracts Then
{
If lowest(C,barssinceentry) > 매도익절
Then exitshort ("매도익1",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.2);
If lowest(C,barssinceentry) < 매도익절
Then exitshort ("매도익2",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.4);
If lowest(C,barssinceentry) < 매도익절-(매도진입-매도익절)/2
Then exitshort ("매도익22",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.8);
}
}
}
2
수식은 작성하신 내용으로 신호가 발생합니다.
다만 선물사나 거래소에서 제도적으로 막은 내용은 수식에서 알수 없습니다.
신호가 발생해서 주문이 집행되어 제도적으로 맞지 않으면 주문거부가 발생하게 됩니다.
즐거운 하루되세요
> 마인드마스터 님이 쓴 글입니다.
> 제목 : 수식에 오류가 있나요?
> *매도진입가격을 입력해서 하락돌파 되면 조정시 매도진입가에서 들어가는 조건입니다.
익절과 손절 가격도 입력해 둡니다.
매도진입=8910.50
매도손절=8987
매도익절=8870
문제가 없다고 생각했는데 진입이후 손절도 익절도 되지가 않네요.
첨부한 이미지와 같이 진입은 정상적으로 되었으며,
시스템모니터에서도 예비신호는 뜨는데 전혀 실행이 안됩니다....
뭐가 문제인가요?
수식은 아래와 같습니다. 봐주십시오.
Input : 거래시작날짜(20200515), 거래시작시간(170000);
Inputs: 매도진입(0), 매도익절(0), 매도손절(0);
Vars: Tcond(false);
if sdate == 거래시작날짜 and
((sdate != sdate[1] and stime >= 거래시작시간) or
(sdate == sdate[1] and stime >= 거래시작시간 and stime[1] < 거래시작시간)) Then
{
Tcond = true;
}
if Tcond == true then
{
#매도조건#
If C < 매도진입
and (C[1] > 매도진입 or C[2] > 매도진입 or C[3] > 매도진입 or C[4] > 매도진입)
and MarketPosition == 0
Then Sell("매도", AtLimit, 매도진입,2);
If IsEntryName("매도") Then {
If currentcontracts == maxcontracts Then {
If C < EntryPrice Then ExitLong("매도익", AtLimit,매도익절,"",1);
If C > EntryPrice Then
ExitLong("매도본", AtLimit, 매도진입);
ExitLong("매도손", AtStop, 매도손절);
}
If currentcontracts < maxcontracts Then {
If lowest(C,barssinceentry) > 매도익절
Then exitshort ("매도익1",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.2);
If lowest(C,barssinceentry) < 매도익절
Then exitshort ("매도익2",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.4);
If lowest(C,barssinceentry) < 매도익절-(매도진입-매도익절)/2
Then exitshort ("매도익22",atstop,entryprice-(entryprice-lowest(C,barssinceentry))*0.8);
}
}
}
추가질문
1. 이해가 안되는 것은 위의 수식처럼 진입, 익절, 손절을 입력하지 않고,
입력은 고점과 저점만 해서 수식에 의해 산출되는 피보나치 되돌림선들을 변수로 사용할 경우에는
같은 조건에 손절, 익절이 된다는 것입니다.
예를 들어 23.8% 선에서 진입 50%선에서 손절로 설정하면 된다는 말이죠.... 왜 그럴까요?
2. 해외선물 나스닥과 같은 경우 HTS상에서 100틱이상은 손절이나 익절을 걸지 못하게 막아놓았던데, 시스템 수식에서는 상관이 없는 거죠?