커뮤니티

문의 드립니다.

프로필 이미지
jesten77
2021-10-25 14:21:22
798
글번호 153129
답변완료

첨부 이미지

항상 감사드립니다~~ 아래 수식으로 데모해 보았는데요.. 종가에 매수 매도 진입하는 것인데, 종가 가격하고 다르게 들어가는 경우가 몇번 있습니다. 그리고 익절, 손절 가격에 청산되지 않고 약 손절 가격으로 청산되는 내용이 몇개 있습니다. bx, sx라고 표시되어 나옵니다. 이 부분은 어떤 문제인지 확인, 수정 부탁드립니다. 그 내역 부분 첨부해서 올립니다. 감사합니다~~^^ 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); Array : H1[50](0),L1[50](0),H2[50](0),L2[50](0); var : Tcond(false); 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; 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 H1[n] > 0 and H2[n] > 0 and H < min(H1[n],H2[n])+PriceScale*1 Then Buy("b",AtStop,max(H1[n],H2[n]+PriceScale*1)); if MarketPosition >= 0 and L1[n] > 0 and L2[n] > 0 and L > max(L1[n],L2[n])-PriceScale*1 Then Sell("s",AtStop,min(L1[n],L2[n])-PriceScale*1); if MarketPosition == 1 Then ExitLong("bx",AtStop,L-PriceScale*1); if MarketPosition == -1 Then ExitShort("sx",AtStop,H+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); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-10-25 17:02:34

안녕하세요 예스스탁입니다. bx와 sx 청산을 삭제한 식입니다. 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); Array : H1[50](0),L1[50](0),H2[50](0),L2[50](0); var : Tcond(false); 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; 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 H1[n] > 0 and H2[n] > 0 and H < min(H1[n],H2[n])+PriceScale*1 Then Buy("b",AtStop,max(H1[n],H2[n]+PriceScale*1)); if MarketPosition >= 0 and L1[n] > 0 and L2[n] > 0 and L > max(L1[n],L2[n])-PriceScale*1 Then Sell("s",AtStop,min(L1[n],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); Array : H1[50](0),L1[50](0),H2[50](0),L2[50](0); var : Tcond(false); 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; 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 H1[n] > 0 and H2[n] > 0 and C > H1[n] and C > H2[n] and C > O Then Buy(); if L1[n] > 0 and L2[n] > 0 and C < L1[n] and C < L2[n] and C < O Then Sell(); } } 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 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 항상 감사드립니다~~ 아래 수식으로 데모해 보았는데요.. 종가에 매수 매도 진입하는 것인데, 종가 가격하고 다르게 들어가는 경우가 몇번 있습니다. 그리고 익절, 손절 가격에 청산되지 않고 약 손절 가격으로 청산되는 내용이 몇개 있습니다. bx, sx라고 표시되어 나옵니다. 이 부분은 어떤 문제인지 확인, 수정 부탁드립니다. 그 내역 부분 첨부해서 올립니다. 감사합니다~~^^ 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); Array : H1[50](0),L1[50](0),H2[50](0),L2[50](0); var : Tcond(false); 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; 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 H1[n] > 0 and H2[n] > 0 and H < min(H1[n],H2[n])+PriceScale*1 Then Buy("b",AtStop,max(H1[n],H2[n]+PriceScale*1)); if MarketPosition >= 0 and L1[n] > 0 and L2[n] > 0 and L > max(L1[n],L2[n])-PriceScale*1 Then Sell("s",AtStop,min(L1[n],L2[n])-PriceScale*1); if MarketPosition == 1 Then ExitLong("bx",AtStop,L-PriceScale*1); if MarketPosition == -1 Then ExitShort("sx",AtStop,H+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); } }