커뮤니티
문의드립니다
2017-11-21 19:34:09
165
글번호 114380
매수수식은 정상적으로 동작합니다
매도 매도청산 수식은 어디에 문제가 있는지 동작하지 않습니다
수정하여 주시면 고맙겠습니다
감사합니다
input : b1(9),b2(9),X1(9),X2(9),진입눌림(3),진입돌파(1),청산눌림(3),청산돌파(1),거래횟수(20),시작시간(090000) ;
var : T1(0),entry(0),LL(0),EH(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
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*진입눌림 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*진입돌파 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;
V1 = LL; //시작점 종가
}
if E1 == 1 and index > i1 then{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림 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*진입돌파 Then{
buy("b2");
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = H;
E1 = 0;
}
if H > EH Then{
EH = H;
E1 = 0;
}
if E1 == 0 and C <= EH-PriceScale*X1 Then{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파 Then{
exitlong("bx1");
E1 = 0;
}
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = H;
E1 = 0;
}
if H > EH Then{
EH = H;
E1 = 0;
}
if E1 == 0 and C <= EH-PriceScale*X2 Then{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파 Then{
exitlong("bx2");
E1 = 0;
}
}
}
}
input : b1(9),b2(9),X1(9),X2(9),진입눌림(3),진입돌파(1),청산눌림(3),청산돌파(1),거래횟수(20),시작시간(090000) ;
var : T1(0),entry(0),HH(0),EL(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
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 = HH;
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*B1 and C[1] > HH-PriceScale*B1 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 >= H1+PriceScale*진입눌림 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*진입돌파 Then{
sell("s1");
}
}
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*B2 and C[1] > HH-PriceScale*B2 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*진입눌림 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*진입돌파 Then{
sell("s2");
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X1 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx1");
E1 = 0;
}
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X2 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx2");
E1 = 0;
}
}
}
}
답변 1
예스스탁 예스스탁 답변
2017-11-22 11:42:04
안녕하세요
예스스탁입니다.
청산쪽에 포지션 지정이 잘못되어 있었습니다.
input : b1(9),b2(9),X1(9),X2(9),진입눌림(3),진입돌파(1),청산눌림(3),청산돌파(1),거래횟수(20),시작시간(090000) ;
var : T1(0),entry(0),HH(0),EL(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
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 = HH;
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*B1 and C[1] > HH-PriceScale*B1 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 >= H1+PriceScale*진입눌림 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*진입돌파 Then{
sell("s1");
}
}
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*B2 and C[1] > HH-PriceScale*B2 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*진입눌림 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*진입돌파 Then{
sell("s2");
}
}
if MarketPosition == -1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X1 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx1");
E1 = 0;
}
}
}
if MarketPosition == -1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X2 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx2");
E1 = 0;
}
}
}
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 매수수식은 정상적으로 동작합니다
매도 매도청산 수식은 어디에 문제가 있는지 동작하지 않습니다
수정하여 주시면 고맙겠습니다
감사합니다
input : b1(9),b2(9),X1(9),X2(9),진입눌림(3),진입돌파(1),청산눌림(3),청산돌파(1),거래횟수(20),시작시간(090000) ;
var : T1(0),entry(0),LL(0),EH(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
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*진입눌림 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*진입돌파 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;
V1 = LL; //시작점 종가
}
if E1 == 1 and index > i1 then{
if H > H1 Then
H1 = H;
#저가가 시작봉종가보다 클때만 눌림체크
if L >= V1 and L <= H1-PriceScale*진입눌림 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*진입돌파 Then{
buy("b2");
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = H;
E1 = 0;
}
if H > EH Then{
EH = H;
E1 = 0;
}
if E1 == 0 and C <= EH-PriceScale*X1 Then{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파 Then{
exitlong("bx1");
E1 = 0;
}
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = H;
E1 = 0;
}
if H > EH Then{
EH = H;
E1 = 0;
}
if E1 == 0 and C <= EH-PriceScale*X2 Then{
E1 = 1;
L1 = L;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if L < L1 Then
L1 = L;
if H >= L1+PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = L1;
}
}
if E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파 Then{
exitlong("bx2");
E1 = 0;
}
}
}
}
input : b1(9),b2(9),X1(9),X2(9),진입눌림(3),진입돌파(1),청산눌림(3),청산돌파(1),거래횟수(20),시작시간(090000) ;
var : T1(0),entry(0),HH(0),EL(0),E1(0),H1(0),i1(0),S1(0),L1(0),V1(0);
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 = HH;
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*B1 and C[1] > HH-PriceScale*B1 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 >= H1+PriceScale*진입눌림 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*진입돌파 Then{
sell("s1");
}
}
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*B2 and C[1] > HH-PriceScale*B2 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*진입눌림 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*진입돌파 Then{
sell("s2");
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X1 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx1");
E1 = 0;
}
}
}
if MarketPosition == 1 Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = L;
E1 = 0;
}
if L < EL Then{
EL = L;
E1 = 0;
}
if E1 == 0 and C >= EL+PriceScale*X2 Then{
E1 = 1;
H1 = H;
i1 = index;
}
if E1 == 1 and index > i1 Then{
if H > H1 Then
H1 = H;
if L <= H1-PriceScale*청산눌림 Then{
E1 = 2;
I1 = index;
S1 = H1;
}
}
if E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파 Then{
ExitShort("sx2");
E1 = 0;
}
}
}
}
다음글
이전글