예스스탁
예스스탁 답변
2021-10-28 17:41:56
안녕하세요
예스스탁입니다.
1. 즉시
input : ntime1(6),ntime2(30),n(10);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(50);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),HH(0),LL(0);
var : Tcond(false),BE1(False),BE2(False),SE1(False),SE2(False);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](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 Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
TF2 = TM%ntime2;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
HH = 0;
LL = 0;
if H1[n] > 0 and L1[n] > 0 Then
{
For cnt = 1 to N
{
if HH == 0 or (HH > 0 and H1[cnt] > HH) Then
HH = H1[cnt];
if LL == 0 or (LL > 0 and L1[cnt] < LL) Then
LL = L1[cnt];
}
}
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and ntime2 > 1 and TM >= TM[1]+ntime2) or
(Bdate == Bdate[1] and ntime2 == 1 and TM > TM[1]) Then
{
H2[0] = H;
L2[0] = L;
For cnt = 1 to 49
{
H2[cnt] = H2[cnt-1][1];
L2[cnt] = L2[cnt-1][1];
}
}
if H2[0] > 0 and H > H2[0] Then
H2[0] = H;
if L2[0] > 0 and L < L2[0] Then
L2[0] = L;
if Tcond == true Then
{
if MarketPosition <= 0 and HH > 0 and H2[n] > 0 Then
Buy("b3",AtStop,max(HH,H2[n])+PriceScale*1);
if MarketPosition >= 0 and LL > 0 and L2[n] > 0 Then
Sell("s3",AtStop,min(LL,L2[n])-PriceScale*1);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
2. 종가
input : ntime1(6),ntime2(30),n(10);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(50);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),HH(0),LL(0);
var : Tcond(false),BE1(False),BE2(False),SE1(False),SE2(False);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](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 Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
TF2 = TM%ntime2;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
HH = 0;
LL = 0;
if H1[n] > 0 and L1[n] > 0 Then
{
For cnt = 1 to N
{
if HH == 0 or (HH > 0 and H1[cnt] > HH) Then
HH = H1[cnt];
if LL == 0 or (LL > 0 and L1[cnt] < LL) Then
LL = L1[cnt];
}
}
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and ntime2 > 1 and TM >= TM[1]+ntime2) or
(Bdate == Bdate[1] and ntime2 == 1 and TM > TM[1]) Then
{
H2[0] = H;
L2[0] = L;
For cnt = 1 to 49
{
H2[cnt] = H2[cnt-1][1];
L2[cnt] = L2[cnt-1][1];
}
}
if H2[0] > 0 and H > H2[0] Then
H2[0] = H;
if L2[0] > 0 and L < L2[0] Then
L2[0] = L;
if Tcond == true Then
{
if MarketPosition <= 0 and HH > 0 and H2[n] > 0 and C > max(HH,H2[n])+PriceScale*1 Then
Buy("b3");
if MarketPosition >= 0 and LL > 0 and L2[n] > 0 and C < min(LL,L2[n])-PriceScale*1 Then
Sell("s3");
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
즐거운 하루되세요
> jesten77 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 제가 문의를 정확히 드리지 못해 죄송합니다.
아래 수식으로 데모해보니 맞지않는 부분이 있습니다.
확인부탁드립니다.
30분봉이 기준이고 거기에 6분봉 조건이 같은 방향이면 매수 매도 진입하는 원칙입니다.
30분봉이 매수신호 나와있으면 6분봉은 매수로만 진입이 되야 합니다.
30분봉이 매도신호 나와있으면 6분봉은 매도로만 진입이 되야 합니다.
* 30분봉
- 매수 신호 조건
1. 30분봉이 이전 10번째 봉 고가 위에 있을 때
단, 현재 캔들이 자기 시가를 깰 때와 앞 캔들의 저가를 깰 때는 매수 신호가 사라지고 다시 회복하면 매수 신호가 나오도록 해주세요.
2. 30분봉이 이전 10번째 봉 고가를 돌파할 때
단, 10번째 봉 고가를 깰 때 매수 신호가 사라지고 다시 돌파하면 매수 신호가 나오도록 해주세요.
- 매도 신호 조건
1. 30분봉이 이전 10번째 봉 저가 아래에 있을 때
단, 현재 캔들이 자기 시가를 돌파할 때와 앞 캔들의 고가를 돌파할 때는 매도 신호가 사라지고 다시 회복하면 매도 신호가 나오도록 해주세요.
2. 30분봉이 이전 10번째 봉 저가를 돌파(깰)할 때
단, 10번째 봉 저가를 돌파할 때 매도 신호가 사라지고 다시 깨면 매도 신호가 나오도록 해주세요.
* 6분봉
- 매수 신호 및 매수 조건
1. 이전 10개 캔들의 최고가를 돌파할 때 매수 신호 및 즉시 매수.
2. 이미 이전 10개 캔들 위에서 시작할 때는 앞 캔들 고가를 돌파할 때 매수 신호 및 즉시 매수
- 매도 신호 및 매도 조건
1. 이전 10개 캔들의 최저가를 돌파할 때 매도 신호 및 즉시 매도.
2. 이미 이전 10개 캔들 아래에서 시작할 때는 앞 캔들 저가를 돌파할 때 매도 신호 및 즉시 매도
## 종가에 진입하는 식에서는 매수는 양봉에만, 매도는 음봉에만 진입하도록 해주세요.
이번 데모에서 이런 문제가 생겨서 남깁니다.
1. 돌파 즉시 매수가 들어가지 않습니다.
2. 30분봉이 30분동안 매수 신호를 유지하고 있는 경우, 6분봉은 이전 5개 캔들 중 최고가를 돌파할 때만 매수 신호가 나오며 매수 진입해야 합니다. 6분봉에서 매도 신호가 나오더라도
30분봉은 매수 신호이니 매도 진입은 하지 않아야 맞는데, 매도 진입이 되고 있습니다.
3. 6분봉에서 이전 10개 캔들의 최고가를 돌파하지 않았는데 매수가 들어가고 있습니다.
아래 수식에서 수정할 부분 확인 수정 부탁드립니다.
감사합니다~~
1 즉시진입
input : ntime1(6),ntime2(30),n(10);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(50);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),HH(0),LL(0);
var : Tcond(false),BE1(False),BE2(False),SE1(False),SE2(False);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](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 Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
TF2 = TM%ntime2;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
HH = 0;
LL = 0;
if H1[n] > 0 and L1[n] > 0 Then
{
For cnt = 1 to N
{
if HH == 0 or (HH > 0 and H1[cnt] > HH) Then
HH = H1[cnt];
if LL == 0 or (LL > 0 and L1[cnt] < LL) Then
LL = L1[cnt];
}
}
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and ntime2 > 1 and TM >= TM[1]+ntime2) or
(Bdate == Bdate[1] and ntime2 == 1 and TM > TM[1]) Then
{
H2[0] = H;
L2[0] = L;
For cnt = 1 to 49
{
H2[cnt] = H2[cnt-1][1];
L2[cnt] = L2[cnt-1][1];
}
BE1 = False;
BE2 = False;
SE1 = False;
SE2 = False;
}
if H2[0] > 0 and H > H2[0] Then
H2[0] = H;
if L2[0] > 0 and L < L2[0] Then
L2[0] = L;
if Tcond == true Then
{
if MarketPosition <= 0 and HH > 0 Then
Buy("b1",AtStop,HH+PriceScale*1);
if MarketPosition <= 0 and H2[n] > 0 Then
Buy("b2",AtStop,H2[n]+PriceScale*1);
if MarketPosition >= 0 and LL > 0 Then
Sell("s1",AtStop,LL-PriceScale*1);
if MarketPosition >= 0 and L2[n] > 0 Then
Sell("s2",AtStop,L2[n]-PriceScale*1);
if MarketPosition <= 0 and HH > 0 and H2[n] > 0 Then
Buy("b3",AtStop,max(HH,H2[n])+PriceScale*1);
if MarketPosition >= 0 and L1[n] > 0 and L2[n] > 0 Then
Sell("s3",AtStop,min(LL,L2[n])-PriceScale*1);
if H >= HH+PriceScale*1 Then
BE1 = true;
if H >= H2[n]+PriceScale*1 Then
BE2 = true;
if L <= LL-PriceScale*1 Then
SE1 = true;
if L <= H2[n]+PriceScale*1 Then
SE2 = true;
if BE1 == true and BE2 == False Then
Buy("b41",AtStop,H2[n]+PriceScale*1);
if BE1 == False and BE2 == true Then
Buy("b42",AtStop,HH+PriceScale*1);
if SE1 == true and SE2 == False Then
Sell("s41",AtStop,L2[n]-PriceScale*1);
if SE1 == False and SE2 == true Then
Sell("s42",AtStop,LL+PriceScale*1);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
2. 종가진입
input : ntime1(6),ntime2(30),n(10);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(50);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0),HH(0),LL(0);
var : Tcond(false),BE1(False),BE2(False),SE1(False),SE2(False);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](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 Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
TF2 = TM%ntime2;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
HH = 0;
LL = 0;
if H1[n] > 0 and L1[n] > 0 Then
{
For cnt = 1 to N
{
if HH == 0 or (HH > 0 and H1[cnt] > HH) Then
HH = H1[cnt];
if LL == 0 or (LL > 0 and L1[cnt] < LL) Then
LL = L1[cnt];
}
}
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and ntime2 > 1 and TM >= TM[1]+ntime2) or
(Bdate == Bdate[1] and ntime2 == 1 and TM > TM[1]) Then
{
H2[0] = H;
L2[0] = L;
For cnt = 1 to 49
{
H2[cnt] = H2[cnt-1][1];
L2[cnt] = L2[cnt-1][1];
}
BE1 = False;
BE2 = False;
SE1 = False;
SE2 = False;
}
if H2[0] > 0 and H > H2[0] Then
H2[0] = H;
if L2[0] > 0 and L < L2[0] Then
L2[0] = L;
if Tcond == true Then
{
if MarketPosition <= 0 and HH > 0 and C > HH+PriceScale*1 Then
Buy("b1");
if MarketPosition <= 0 and H2[n] > 0 and C > H2[n]+PriceScale*1 Then
Buy("b2");
if MarketPosition >= 0 and LL > 0 and C < LL-PriceScale*1 Then
Sell("s1");
if MarketPosition >= 0 and L2[n] > 0 and C < L2[n]-PriceScale*1 Then
Sell("s2");
if MarketPosition <= 0 and HH > 0 and H2[n] > 0 and C > max(HH,H2[n])+PriceScale*1 Then
Buy("b3");
if MarketPosition >= 0 and L1[n] > 0 and L2[n] > 0 and C < min(LL,L2[n])-PriceScale*1 Then
Sell("s3");
if C >= HH+PriceScale*1 Then
BE1 = true;
if C >= H2[n]+PriceScale*1 Then
{
BE2 = true;
}
if C <= LL-PriceScale*1 Then
SE1 = true;
if C <= H2[n]+PriceScale*1 Then
SE2 = true;
if BE1 == true and BE2 == true and (BE1[1] == False or BE2[1] == False) Then
Buy("b4");
if SE1 == true and SE2 == true and (SE1[1] == true or SE2 == False) Then
Sell("s4");
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}