커뮤니티

문의

프로필 이미지
좌오비우오비
2020-11-04 15:25:39
638
글번호 143607
답변완료
예전에 답변주신 수식인데 좀 지나서 문의드립니다. - buy 수식에서 b1 진입은 X1 에 연결되어 exitlong(bx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitlong(bx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitlong(bx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitlong(bx2) 수식이 적용되어 청산결과도 exitlong(bx2)가 표시될 수 있게 수식을 수정바랍니다. - sell 수식에서 b1 진입은 X1 에 연결되어 exitshort(sx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitshort(sx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitshort(sx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitshort(sx2) 수식이 적용되어 청산결과도 exitshort(sx2)가 표시될 수 있게 수식을 수정바랍니다. **************************************************************************************** 1) buy 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true 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; } } } } 2) sell 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); 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*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; } } } }
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2020-11-04 18:10:33

안녕하세요 예스스탁입니다. 올려주신 수식의 청산식에 특정이름의 진입에만 동작하는 내용이 없습니다. 그러므로 위아래의 2개의 청산중에 먼저 만족한 것으로 발생하게 되고 동일하면 식작성상 위에 있는 청산으로 발생하게 됩니다. 각 청산식에 진입명 조건을 추가해 드립니다. 1 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true Then{ buy("b2"); } } if MarketPosition == 1 and IsEntryName("b1") ==true 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 and IsEntryName("b2") == true 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; } } } } 2 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); E1 = 0; } } if MarketPosition == -1 and IsEntryName("s1") == true 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 and IsEntryName("s2") == true 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; } } } } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 문의 > 예전에 답변주신 수식인데 좀 지나서 문의드립니다. - buy 수식에서 b1 진입은 X1 에 연결되어 exitlong(bx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitlong(bx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitlong(bx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitlong(bx2) 수식이 적용되어 청산결과도 exitlong(bx2)가 표시될 수 있게 수식을 수정바랍니다. - sell 수식에서 b1 진입은 X1 에 연결되어 exitshort(sx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitshort(sx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitshort(sx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitshort(sx2) 수식이 적용되어 청산결과도 exitshort(sx2)가 표시될 수 있게 수식을 수정바랍니다. **************************************************************************************** 1) buy 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true 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; } } } } 2) sell 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); 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*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; } } } }
프로필 이미지

좌오비우오비

2020-11-05 08:19:15

답변 고맙습니다. input에 진입시간이 있습니다. 090000 세팅이면 090000 부터 발생한 봉부터 계산 100000 세팅이면 100000 부터 발생한 봉부터 계산 하는 수식인지요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 > 안녕하세요 예스스탁입니다. 올려주신 수식의 청산식에 특정이름의 진입에만 동작하는 내용이 없습니다. 그러므로 위아래의 2개의 청산중에 먼저 만족한 것으로 발생하게 되고 동일하면 식작성상 위에 있는 청산으로 발생하게 됩니다. 각 청산식에 진입명 조건을 추가해 드립니다. 1 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true Then{ buy("b2"); } } if MarketPosition == 1 and IsEntryName("b1") ==true 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 and IsEntryName("b2") == true 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; } } } } 2 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); E1 = 0; } } if MarketPosition == -1 and IsEntryName("s1") == true 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 and IsEntryName("s2") == true 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; } } } } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 문의 > 예전에 답변주신 수식인데 좀 지나서 문의드립니다. - buy 수식에서 b1 진입은 X1 에 연결되어 exitlong(bx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitlong(bx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitlong(bx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitlong(bx2) 수식이 적용되어 청산결과도 exitlong(bx2)가 표시될 수 있게 수식을 수정바랍니다. - sell 수식에서 b1 진입은 X1 에 연결되어 exitshort(sx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitshort(sx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitshort(sx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitshort(sx2) 수식이 적용되어 청산결과도 exitshort(sx2)가 표시될 수 있게 수식을 수정바랍니다. **************************************************************************************** 1) buy 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true 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; } } } } 2) sell 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); 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*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; } } } }
프로필 이미지

예스스탁 예스스탁 답변

2020-11-05 10:32:52

안녕하세요 예스스탁입니다. 예 맞습니다. 전체 진입/청산이 if stime >= 진입시간 then 조건에 묶여 있어 지정한 진입시간 이후의 값으로 계산합니다. 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : Re : Re : 문의 > 답변 고맙습니다. input에 진입시간이 있습니다. 090000 세팅이면 090000 부터 발생한 봉부터 계산 100000 세팅이면 100000 부터 발생한 봉부터 계산 하는 수식인지요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 > 안녕하세요 예스스탁입니다. 올려주신 수식의 청산식에 특정이름의 진입에만 동작하는 내용이 없습니다. 그러므로 위아래의 2개의 청산중에 먼저 만족한 것으로 발생하게 되고 동일하면 식작성상 위에 있는 청산으로 발생하게 됩니다. 각 청산식에 진입명 조건을 추가해 드립니다. 1 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true Then{ buy("b2"); } } if MarketPosition == 1 and IsEntryName("b1") ==true 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 and IsEntryName("b2") == true 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; } } } } 2 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); E1 = 0; } } if MarketPosition == -1 and IsEntryName("s1") == true 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 and IsEntryName("s2") == true 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; } } } } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 문의 > 예전에 답변주신 수식인데 좀 지나서 문의드립니다. - buy 수식에서 b1 진입은 X1 에 연결되어 exitlong(bx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitlong(bx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitlong(bx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitlong(bx2) 수식이 적용되어 청산결과도 exitlong(bx2)가 표시될 수 있게 수식을 수정바랍니다. - sell 수식에서 b1 진입은 X1 에 연결되어 exitshort(sx1)으로 청산됩니다. b2 진입부터는 X2 에 연결되어 exitshort(sx2)로 청산하는 수식이지만 b2 청산결과가 이상하게 exitshort(sx1)으로 표시됩니다. b2 진입부터는 X2에 따라 exitshort(sx2) 수식이 적용되어 청산결과도 exitshort(sx2)가 표시될 수 있게 수식을 수정바랍니다. **************************************************************************************** 1) buy 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100) ; var : T1(0),entry(0),LL(0),EH(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; 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*진입돌파 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; 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*진입돌파 and Tcond == true 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; } } } } 2) sell 수식 input : 진입시간(090000),진입제한시간(140000); input : b1(20),b2(30),X1(20),X2(30),진입눌림(20),진입돌파(30),청산눌림(20),청산돌파(30),거래횟수(100); 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*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 >= 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*진입돌파 and Tcond == true 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; } 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*진입돌파 and Tcond == true Then{ sell("s2"); 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*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; } } } }