예스스탁
예스스탁 답변
2020-10-16 14:17:14
안녕하세요
예스스탁입니다.
input : StartTime(101500),EndTime(130000);
var : Tcond(false),idx(0),entry(0);
var : T(0),T1(0),P(0),N(0),B(False),S(False);
var : HH(0),HL(0),HM(0),LL(0),LH(0),LM(0),cnt(0);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
T = 0;
T1 = 0;
HL = 0;
LH = 0;
idx = 0;
entry = 0;
Tcond = true;
if EndTime < StartTime Then
SetStopEndofday(0);
}
if EndTime > StartTime Then
SetStopEndofday(EndTime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if Tcond == true Then
{
idx = idx+1;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if C > O Then
T = 1;
if C < O Then
T = -1;
if entry >= 1 and TotalTrades > TotalTrades[1] and IsExitName("매수익절",1) == true Then
HL = 0;
if TotalTrades < TotalTrades[1] and IsExitName("매도익절",1) == true Then
LH = 0;
if idx >= 2 and T != T[1] Then
{
T1 = T[1];
}
if idx >= 2 and T == 1 and CountIf(C > O and C > C[1],2) == 2 Then
{
T = 2;
P = Index[1];
if T1 == -2 Then
{
LL = L;
LH = H;
For cnt = 0 to Index-N
{
if L[cnt] < LL then
{
LL = L[cnt];
LH = H[cnt];
LM = (LL+LH)/2;
}
}
}
}
if idx >= 2 and T == -1 and CountIf(C < O and C < C[1],2) == 2 Then
{
T = -2;
N = Index[1];
if T1 == 2 Then
{
HH = H;
HL = L;
For cnt = 0 to Index-P
{
if H[cnt] > HH then
{
HH = H[cnt];
HL = L[cnt];
HM = (HH+HL)/2;
}
}
}
}
if MarketPosition == 0 and HL > 0 and HH >= HL+PriceScale*12 and NextBarOpen < HL and Tcond == true Then
{
Buy("매수",AtStop,HL+PriceScale*3);
ExitLong("매수익절.",AtLimit,HM);
}
if MarketPosition == 1 Then
{
ExitLong("매수익절",AtLimit,HM[BarsSinceEntry]);
ExitLong("매수손절",AtStop,L[BarsSinceEntry+1]);
}
if MarketPosition == 0 and LH > 0 and LH >= LL+PriceScale*12 and NextBarOpen > LH and Tcond == true Then
Sell("매도",AtStop,LH-PriceScale*3);
ExitShort("매도익절.",AtLimit,LM);
if MarketPosition == -1 Then
{
ExitShort("매도익절",AtLimit,LM[BarsSinceEntry]);
ExitShort("매도손절",AtStop,H[BarsSinceEntry+1]);
}
}
즐거운 하루되세요
> 밤밤 님이 쓴 글입니다.
> 제목 : 수식 수정 및 보완 부탁드립니다.
> 현재 다른 시그널이 올때까지 기존 시그널 자리가오면 계속 진입하는데
익절하고 나온 시그널은 다시 진입하지 않게 해주세요.
익절하면 시그널 리셋 입니다.
손절시만 다시 진입하게 해주시고 다시 진입전 새로운 시그널이 오면 먼저 오는 시그널로 진입하게 해주세요.
그리고 현재 기준봉의 절반에서 익절청산으로 되어있는데
기준봉의 (고가-저가) 크기가 12틱 이상일 경우에만 시그널로 인정하고 진입하게 부탁드립니다.
그보다 낮은경우에는 진입금지
+추가
매매를 시작한 시간부터 조건 카운팅되게 할 순 없나요?
예를들어 아래수식에선 10시 15분 시작인데 그 이전 데이터를 포함해서 조건을 카운팅해서
진입을 하더라구요.
10시 15분 시작이면 이전데이터는 무시하고 시작시간부터 조건이 만들어지면 진입되는식으로 부탁드립니다.
아래 수식에서 수정부탁드립니다.
input : StartTime(101500),EndTime(130000);
var : Tcond(false);
var : T(0),T1(0),P(0),N(0),B(False),S(False);
var : HH(0),HL(0),HM(0),LL(0),LH(0),LM(0),cnt(0);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
if EndTime < StartTime Then
SetStopEndofday(0);
}
if EndTime > StartTime Then
SetStopEndofday(EndTime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if C > O Then
T = 1;
if C < O Then
T = -1;
if T != T[1] Then
{
T1 = T[1];
}
if T == 1 and CountIf(C > O and C > C[1],2) == 2 Then
{
T = 2;
P = Index[1];
if T1 == -2 Then
{
LL = L;
LH = H;
For cnt = 0 to Index-N
{
if L[cnt] < LL then
{
LL = L[cnt];
LH = H[cnt];
LM = (LL+LH)/2;
}
}
}
}
if T == -1 and CountIf(C < O and C < C[1],2) == 2 Then
{
T = -2;
N = Index[1];
if T1 == 2 Then
{
HH = H;
HL = L;
For cnt = 0 to Index-P
{
if H[cnt] > HH then
{
HH = H[cnt];
HL = L[cnt];
HM = (HH+HL)/2;
}
}
}
}
if MarketPosition == 0 and HL > 0 and NextBarOpen < HL and Tcond == true Then
{
Buy("매수",AtStop,HL+PriceScale*3);
ExitLong("매수익절.",AtLimit,HM);
}
if MarketPosition == 1 Then
{
ExitLong("매수익절",AtLimit,HM[BarsSinceEntry]);
ExitLong("매수손절",AtStop,L[BarsSinceEntry+1]);
}
if MarketPosition == 0 and LH > 0 and NextBarOpen > LH and Tcond == true Then
Sell("매도",AtStop,LH-PriceScale*3);
ExitShort("매도익절.",AtLimit,LM);
if MarketPosition == -1 Then
{
ExitShort("매도익절",AtLimit,LM[BarsSinceEntry]);
ExitShort("매도손절",AtStop,H[BarsSinceEntry+1]);
}