예스스탁
예스스탁 답변
2021-05-21 15:37:46
안녕하세요
예스스탁입니다.
if data2(E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2) Then
{
해당식 통화후에 살펴보다가 b2나 s2로 추가진입을 하는 이유를 알았습니다.
해당 수식내에 있는 청산식으로 청산되면 E1이 0으로 초기화되는데
트레일링스탑이나 따로 지정된 강제청산이나 청산식으로 청산이 되면
E1이 0으로 초기화가 안되고 계속 값이 유지가 되어 위 조건문이 패스되었습니다.
if TotalTrades > TotalTrades[1] Then
E1 = 0;
수식에 위 내용을 추가하시면 됩니다.
1 buy
Input : 최대(999999999),최소(0),거래횟수(500);
input : b1(10),b2(777888999),X1(10),X2(10);
input : 진입눌림1(10),진입돌파1(10),청산눌림1(10),청산돌파1(10);
input : 진입눌림2(10),진입돌파2(10),청산눌림2(10),청산돌파2(10);
var : T1(0,data1),entry(0,data1);
var : LL(0,data2),EH(0,data2),E1(0,data2),H1(0,data2);
var : i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
if data1(Bdate != Bdate[1]) Then
T1 = TotalTrades;
if data2(Bdate != Bdate[1]) Then{
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then{
if data2(E1 == 0 and C >= DL2+PriceScale*B1 and C[1] < DL2+PriceScale*B1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림1) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1) Then{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
{
LL = data2(L);
E1 = 0;
}
if data2(L < LL) Then
LL = data2(L);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then
{
if data2(E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2) Then
{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then
{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림2) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2) Then{
buy("b2");
}
}
if MarketPosition == 1 and IsEntryName("b1") == true Then
{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = data2(H);
E1 = 0;
}
if data2(H > EH) Then{
EH = data2(H);
E1 = 0;
}
if data2(E1 == 0 and C <= EH-PriceScale*X1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*청산눌림1) Then{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파1) Then
{
exitlong("bx1");
E1 = 0;
}
}
}
if MarketPosition == 1 and IsEntryName("b2") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = data2(H);
E1 = 0;
}
if data2(H > EH) Then{
EH = data2(H);
E1 = 0;
}
if data2(E1 == 0 and C <= EH-PriceScale*X1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*청산눌림2) Then{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파2) Then{
exitlong("bx2");
E1 = 0;
}
}
}
2 sell
Input : 최대(999999999),최소(0),거래횟수(500);
input : b1(10),b2(777888999),X1(10),X2(10);
input : 진입눌림1(10),진입돌파1(10),청산눌림1(10),청산돌파1(10);
input : 진입눌림2(10),진입돌파2(10),청산눌림2(10),청산돌파2(10);
var : T1(0,data1),entry(0,data1);
var : HH(0,data2),LL(0,data2),EH(0,data2),EL(0,data2);
var : E1(0,data2),H1(0,data2),i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
if data1(Bdate != Bdate[1]) Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if data2(Bdate != Bdate[1]) Then{
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 and entry == 0 Then{
if data2(E1 == 0 and C <= DH2-PriceScale*B1 and C[1] < DH2-PriceScale*B1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if E1 == 1 and data2(index) > i1 then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*진입눌림1) Then{
E1 = 2;
i1 = data2(index);
S1 = L1;
}
}
if 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파1) Then{
sell("s1");
}
}
if TotalTrades > TotalTrades[1] Then
{
HH = data2(H);
E1 = 0;
}
if data2(H > HH) Then
HH = data2(H);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then{
if data2(E1 == 0 and C <= HH-PriceScale*B2 and C[1] < HH-PriceScale*B2) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*진입눌림2) Then{
E1 = 2;
i1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파2) Then{
sell("s2");
E1 = 0;
}
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = data2(L);
E1 = 0;
}
if data2(L < EL) Then{
EL = data2(L);
E1 = 0;
}
if data2(E1 == 0 and C >= EL+PriceScale*X1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*청산눌림1) Then{
E1 = 2;
I1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파1) Then{
ExitShort("sx1");
E1 = 0;
}
}
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = data2(L);
E1 = 0;
}
if data2(L < EL) Then{
EL = data2(L);
E1 = 0;
}
if data2(E1 == 0 and C >= EL+PriceScale*X1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*청산눌림2) Then{
E1 = 2;
I1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파2) Then{
ExitShort("sx2");
E1 = 0;
}
}
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> buy 수식에서
1차 진입 b1에 10 입력후
2차 진입 b2에 777888999를 입력하면 data2 선물기준 틱수이므로
2차 진입은 발생하지 않아야 하는데 진입이 발생합니다
sell 수식에서
1차 진입 b1에 10 입력후
2차 진입 b2에 777888999를 입력하면 data2 선물기준 틱수이므로
2차 진입은 발생하지 않아야 하는데 진입이 발생합니다
첨부파일은 2차 진입발생 내역입니다.
buy와 sell 수식의 2차(b2) 진입수식을 살펴주시고 고친부분은 # 표시해주세요.
********************************************************************************
1) buy 수식
Input : 최대(999999999),최소(0),거래횟수(500);
input : b1(10),b2(777888999),X1(10),X2(10);
input : 진입눌림1(10),진입돌파1(10),청산눌림1(10),청산돌파1(10);
input : 진입눌림2(10),진입돌파2(10),청산눌림2(10),청산돌파2(10);
var : T1(0,data1),entry(0,data1);
var : LL(0,data2),EH(0,data2),E1(0,data2),H1(0,data2);
var : i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
if data1(Bdate != Bdate[1]) Then
T1 = TotalTrades;
if data2(Bdate != Bdate[1]) Then{
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if MarketPosition == 0 and entry == 0 Then{
if data2(E1 == 0 and C >= DL2+PriceScale*B1 and C[1] < DL2+PriceScale*B1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림1) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파1) Then{
buy("b1");
}
}
if TotalTrades > TotalTrades[1] Then
LL = data2(L);
if data2(L < LL) Then
LL = data2(L);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then{
if data2(E1 == 0 and C >= LL+PriceScale*B2 and C[1] < LL+PriceScale*B2) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*진입눌림2) Then{
E1 = 2;
i1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*진입돌파2) Then{
buy("b2");
}
}
if MarketPosition == 1 and IsEntryName("b1") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = data2(H);
E1 = 0;
}
if data2(H > EH) Then{
EH = data2(H);
E1 = 0;
}
if data2(E1 == 0 and C <= EH-PriceScale*X1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*청산눌림1) Then{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파1) Then{
exitlong("bx1");
E1 = 0;
}
}
}
if MarketPosition == 1 and IsEntryName("b2") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EH = data2(H);
E1 = 0;
}
if data2(H > EH) Then{
EH = data2(H);
E1 = 0;
}
if data2(E1 == 0 and C <= EH-PriceScale*X1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*청산눌림2) Then{
E1 = 2;
I1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*청산돌파2) Then{
exitlong("bx2");
E1 = 0;
}
}
}
2) sell 수식
Input : 최대(999999999),최소(0),거래횟수(500);
input : b1(10),b2(777888999),X1(10),X2(10);
input : 진입눌림1(10),진입돌파1(10),청산눌림1(10),청산돌파1(10);
input : 진입눌림2(10),진입돌파2(10),청산눌림2(10),청산돌파2(10);
var : T1(0,data1),entry(0,data1);
var : HH(0,data2),LL(0,data2),EH(0,data2),EL(0,data2);
var : E1(0,data2),H1(0,data2),i1(0,data2),S1(0,data2),L1(0,data2);
var : DH2(0,data2),DL2(0,data2);
if data1(Bdate != Bdate[1]) Then
T1 = TotalTrades;
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = (TotalTrades-T1)+1;
if data2(Bdate != Bdate[1]) Then{
E1 = 0;
DH2 = data2(H);
DL2 = data2(L);
}
if data2(H > DH2) Then
DH2 = data2(H);
if data2(L < DL2) Then
DL2 = data2(L);
if MarketPosition == 0 and entry == 0 Then{
if data2(E1 == 0 and C <= DH2-PriceScale*B1 and C[1] < DH2-PriceScale*B1) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if E1 == 1 and data2(index) > i1 then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*진입눌림1) Then{
E1 = 2;
i1 = data2(index);
S1 = L1;
}
}
if 최대 >= C and C >= 최소 and data2(E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파1) Then{
sell("s1");
}
}
if TotalTrades > TotalTrades[1] Then
HH = data2(H);
if data2(H > HH) Then
HH = data2(H);
if MarketPosition == 0 and entry >= 1 and entry < 거래횟수 Then{
if data2(E1 == 0 and C <= HH-PriceScale*B2 and C[1] < HH-PriceScale*B2) Then{
E1 = 1;
L1 = data2(L);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) then{
if data2(L < L1) Then
L1 = data2(L);
if data2(H >= L1+PriceScale*진입눌림2) Then{
E1 = 2;
i1 = data2(index);
S1 = L1;
}
}
if data2(E1 == 2 and index > i1 and C <= S1-PriceScale*진입돌파2) Then{
sell("s2");
E1 = 0;
}
}
if MarketPosition == -1 and IsEntryName("s1") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = data2(L);
E1 = 0;
}
if data2(L < EL) Then{
EL = data2(L);
E1 = 0;
}
if data2(E1 == 0 and C >= EL+PriceScale*X1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*청산눌림1) Then{
E1 = 2;
I1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파1) Then{
ExitShort("sx1");
E1 = 0;
}
}
}
if MarketPosition == -1 and IsEntryName("s2") == true Then{
if entry >= 1 then{
if CurrentContracts > CurrentContracts[1] Then{
EL = data2(L);
E1 = 0;
}
if data2(L < EL) Then{
EL = data2(L);
E1 = 0;
}
if data2(E1 == 0 and C >= EL+PriceScale*X1) Then{
E1 = 1;
H1 = data2(H);
i1 = data2(index);
}
if data2(E1 == 1 and index > i1) Then{
if data2(H > H1) Then
H1 = data2(H);
if data2(L <= H1-PriceScale*청산눌림2) Then{
E1 = 2;
I1 = data2(index);
S1 = H1;
}
}
if data2(E1 == 2 and index > i1 and C >= S1+PriceScale*청산돌파2) Then{
ExitShort("sx2");
E1 = 0;
}
}
}