예스스탁
예스스탁 답변
2021-02-10 16:15:30
안녕하세요
예스스탁입니다.
매수식 2번째 식의 중괄호가 잘못 지정되어 있었습니다.
if MarketPosition == 0 and entry == 1 and entry < 거래횟수 Then 조건에
밖에 buy("b2"); 조건이 지정되어 있어 b3가 발생하기 전에 b2로 계속 들어가고 있었습니다.
input : 진입시간(090000),진입제한시간(151500);
input : 거래횟수(20);
input : b1(40),진입눌림1(10),진입돌파1(10);
input : b2(40),진입눌림2(10),진입돌파2(10);
input : b3(40),진입눌림3(10),진입돌파3(10);
var : T1(0),entry(0),LL(0),EH(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
var : Tcond(false);
Var : loss(0);
if bdate != bdate[1] Then
loss = 0;
if TotalTrades > TotalTrades[1] and PositionProfit(1) < 0 Then
loss = loss+1;
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then
Tcond = true;
if (sdate != sdate[1] and stime >= 진입제한시간) or
(sdate == sdate[1] and stime >= 진입제한시간 and stime[1] < 진입제한시간) Then
Tcond = false;
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then{
T1 = TotalTrades;
E1 = 0;
LL = L;
}
if stime >= 진입시간 then
{
if L < LL Then
LL = L;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then
{
if E1 == 0 and C >= LL+PriceScale*B1 and C[1] < LL+PriceScale*B1 Then
{
E1 = 1;
H1 = H;
i1 = index;
V1 = LL; //시작점 종가
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림1 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and L < V1 Then
{
E1 = 0;
LL = L;
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1 and Tcond == true Then
{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
{
E1 = 0;
LL = L;
}
if L < LL Then
LL = L;
if MarketPosition == 0 and entry == 1 and entry < 거래횟수 Then
{
if E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2 Then
{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림2 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and L < V1 Then
{
E1 = 0;
LL = L;
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2 and Tcond == true Then
{
buy("b2");
}
}
if MarketPosition == 0 and entry >= 2 and entry < 거래횟수 Then
{
if E1 == 0 and C >= LL+PriceScale*B3 and C[1] < LL+PriceScale*B3 Then
{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림3 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파3 and Tcond == true Then
{
buy("b3");
}
}
}
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 문의
> 아래 수식과 반대인 buy 수식을 작성해보았습니다.
b3 진입이 발생하지 않는데 수식 검토바랍니다.
input : 진입시간(090000),진입제한시간(151500);
input : 거래횟수(20);
input : b1(40),진입눌림1(10),진입돌파1(10);
input : b2(40),진입눌림2(10),진입돌파2(10);
input : b3(40),진입눌림3(10),진입돌파3(10);
var : T1(0),entry(0),LL(0),EH(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
var : Tcond(false);
Var : loss(0);
if bdate != bdate[1] Then
loss = 0;
if TotalTrades > TotalTrades[1] and PositionProfit(1) < 0 Then
loss = loss+1;
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then
Tcond = true;
if (sdate != sdate[1] and stime >= 진입제한시간) or
(sdate == sdate[1] and stime >= 진입제한시간 and stime[1] < 진입제한시간) Then
Tcond = false;
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then{
T1 = TotalTrades;
E1 = 0;
LL = L;
}
if stime >= 진입시간 then
{
if L < LL Then
LL = L;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then
{
if E1 == 0 and C >= LL+PriceScale*B1 and C[1] < LL+PriceScale*B1 Then
{
E1 = 1;
H1 = H;
i1 = index;
V1 = LL; //시작점 종가
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림1 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and L < V1 Then
{
E1 = 0;
LL = L;
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1 and Tcond == true Then
{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
{
E1 = 0;
LL = L;
}
if L < LL Then
LL = L;
if MarketPosition == 0 and entry == 1 and entry < 거래횟수 Then
{
if E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2 Then
{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
}
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림2 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
//시작점 종가보다 낮은 가격이 발생하면 초기화
if E1 >= 1 and L < V1 Then
{
E1 = 0;
LL = L;
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2 and Tcond == true Then
{
buy("b2");
}
if MarketPosition == 0 and entry >= 2 and entry < 거래횟수 Then
{
if E1 == 0 and C >= LL+PriceScale*B3 and C[1] < LL+PriceScale*B3 Then
{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림3 Then
{
E1 = 2;
i1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파3 and Tcond == true Then
{
buy("b3");
}
}
}
**************************************************************************************
input : 진입시간(090000),진입제한시간(151500);
input : 거래횟수(20);
input : d1(40),진입눌림1(10),진입돌파1(10);
input : d2(40),진입눌림2(10),진입돌파2(10);
input : d3(40),진입눌림3(10),진입돌파3(10);
var : T1(0),entry(0),HH(0),LL(0),EH(0),EL(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
var : Tcond(false);
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then
Tcond = true;
if (sdate != sdate[1] and stime >= 진입제한시간) or
(sdate == sdate[1] and stime >= 진입제한시간 and stime[1] < 진입제한시간) Then
Tcond = false;
if (sdate != sdate[1] and stime >= 진입시간) or
(sdate == sdate[1] and stime >= 진입시간 and stime[1] < 진입시간) Then{
T1 = TotalTrades;
E1 = 0;
HH = H;
}
if stime >= 진입시간 then
{
if H > HH Then
HH = H;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then
{
if E1 == 0 and C <= HH-PriceScale*d1 and C[1] < HH-PriceScale*d1 Then
{
E1 = 1;
L1 = L;
i1 = index;
V1 = HH; //시작점 종가
}
if E1 == 1 and index > i1 then
{
if L < L1 Then
L1 = L;
#고가가 시작봉종가보다 작을 때만 눌림체크
if H <= V1 and H >= L1+PriceScale*진입눌림1 Then
{
E1 = 2;
i1 = index;
S1 = L1;
}
}
//시작점 종가보다 높은 가격이 발생하면 초기화
if E1 >= 1 and H > V1 Then
{
E1 = 0;
HH = H;
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파1 and Tcond == true Then
{
sell("d1");
}
}
if TotalTrades > TotalTrades[1] Then
{
E1 = 0;
HH = H;
}
if H > HH Then
HH = H;
if MarketPosition == 0 and entry == 1 and entry < 거래횟수 Then
{
if E1 == 0 and C <= HH-PriceScale*d2 and C[1] < HH-PriceScale*d2 Then
{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*진입눌림2 Then
{
E1 = 2;
i1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파2 and Tcond == true Then
{
sell("d2");
E1 = 0;
}
}
if MarketPosition == 0 and entry >= 2 and entry < 거래횟수 Then
{
if E1 == 0 and C <= HH-PriceScale*d3 and C[1] < HH-PriceScale*d3 Then
{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 then
{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*진입눌림3 Then
{
E1 = 2;
i1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파3 and Tcond == true Then
{
sell("d3");
E1 = 0;
}
}
}