커뮤니티

수식 수정 및 보완 부탁드립니다.

프로필 이미지
밤밤
2020-10-14 18:11:57
913
글번호 143102
답변완료

첨부 이미지

현재 수식인데요 여기서 진입할 자리가왔는데도 진입을 안합니다. 그리고 진입한 봉에서는 익절 청산라인에 도달해도 청산이 안되는거 같아요 꼭 다음봉 넘어가서 자리에와야 청산을 합니다. 그래서 익절할 것도 손절하게 됩니다. 진입봉 및 청산봉은 조건 만들어질때 카운팅 제외된거 같은데 조건에 카운팅되게 부탁드립니다. 예를들어 양양음음 4개봉이 카운팅 되어야 조건만족인데 위 4개봉중 첫번째 양봉이 그전 조건에 진입 및 청산봉이면 카운팅 되지 않고 조건이 완성이 안되네요. 수정 및 보완 부탁드립니다. 그리고 데이터 시뮬레이션상 익절청산시 원래자리에서 청산이 되는게 아니라 더 밀려서 청산되는 경우가 많더라구요. 그래서 정확한 데이터 분석에 어려움이 있는데 이거는 어쩔 수 없는건가요? input : StartTime(101500),EndTime(130000); var : Tcond(false); var : T(0),T1(0),P(0),N(0),B(False),S(False); var : HH(0),HL(0),HM(0),LL(0),LH(0),LM(0),cnt(0); 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 EndTime < StartTime Then SetStopEndofday(0); } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sDate != sDate[1] Then SetStopEndofday(EndTime); } if C > O Then T = 1; if C < O Then T = -1; if T != T[1] Then { T1 = T[1]; } if T == 1 and Condition1 == False and CountIf(C > O and C > C[1],2) == 2 Then { T = 2; P = Index[1]; if T1 == -2 Then { B = False; S = true; LL = L; LH = H; For cnt = 0 to Index-N { if L[cnt] < LL then { LL = L[cnt]; LH = H[cnt]; LM = (LL+LH)/2; } } } Else S = False; } if T == -1 and Condition2 == False and CountIf(C < O and C < C[1],2) == 2 Then { T = -2; N = Index[1]; if T1 == 2 Then { S = False; B = true; HH = H; HL = L; For cnt = 0 to Index-P { if H[cnt] > HH then { HH = H[cnt]; HL = L[cnt]; HM = (HH+HL)/2; } } } Else B = False; } if MarketPosition == 0 and HL > 0 and B == true and NextBarOpen < HL and Tcond == true Then Buy("b",AtStop,HL+PriceScale*3); if MarketPosition == 1 Then { ExitLong("bp",AtLimit,HM[BarsSinceEntry]); ExitLong("bl",AtStop,L[BarsSinceEntry+1]); } if MarketPosition == 0 and LH > 0 and S == true and NextBarOpen > LH and Tcond == true Then Sell("s",AtStop,LH-PriceScale*3); if MarketPosition == -1 Then { ExitShort("sp",AtLimit,LM[BarsSinceEntry]); ExitShort("sl",AtStop,H[BarsSinceEntry+1]); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-10-15 15:18:59

안녕하세요 예스스탁입니다. 1 반대방향 조건 충족시에 제한하는 내용이 있어 해당 부분을 삭제했습니다. 2 if문이 봉완성기준으로 청산식의 MarketPosition == 1과 같은 조건이 진입후 봉이 완성되어야 조건만족이 됩니다. 진입과 동시에 손절이나 익절이 같이 셋팅되는 내용을 추가해서 진입봉에서도 청산이 발생하게 수정해 드립니다. 3 input : StartTime(101500),EndTime(130000); var : Tcond(false); var : T(0),T1(0),P(0),N(0),B(False),S(False); var : HH(0),HL(0),HM(0),LL(0),LH(0),LM(0),cnt(0); 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 EndTime < StartTime Then SetStopEndofday(0); } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sDate != sDate[1] Then SetStopEndofday(EndTime); } if C > O Then T = 1; if C < O Then T = -1; if T != T[1] Then { T1 = T[1]; } if T == 1 and CountIf(C > O and C > C[1],2) == 2 Then { T = 2; P = Index[1]; if T1 == -2 Then { LL = L; LH = H; For cnt = 0 to Index-N { if L[cnt] < LL then { LL = L[cnt]; LH = H[cnt]; LM = (LL+LH)/2; } } } } if T == -1 and CountIf(C < O and C < C[1],2) == 2 Then { T = -2; N = Index[1]; if T1 == 2 Then { HH = H; HL = L; For cnt = 0 to Index-P { if H[cnt] > HH then { HH = H[cnt]; HL = L[cnt]; HM = (HH+HL)/2; } } } } if MarketPosition == 0 and HL > 0 and NextBarOpen < HL and Tcond == true Then { Buy("b",AtStop,HL+PriceScale*3); ExitLong("bp.",AtLimit,HM); ExitLong("bl.",AtStop,L); } if MarketPosition == 1 Then { ExitLong("bp",AtLimit,HM[BarsSinceEntry]); ExitLong("bl",AtStop,L[BarsSinceEntry+1]); } if MarketPosition == 0 and LH > 0 and NextBarOpen > LH and Tcond == true Then Sell("s",AtStop,LH-PriceScale*3); ExitShort("sp.",AtLimit,LM); ExitShort("sl.",AtStop,H); if MarketPosition == -1 Then { ExitShort("sp",AtLimit,LM[BarsSinceEntry]); ExitShort("sl",AtStop,H[BarsSinceEntry+1]); } 즐거운 하루되세요 > 밤밤 님이 쓴 글입니다. > 제목 : 수식 수정 및 보완 부탁드립니다. > 현재 수식인데요 여기서 진입할 자리가왔는데도 진입을 안합니다. 그리고 진입한 봉에서는 익절 청산라인에 도달해도 청산이 안되는거 같아요 꼭 다음봉 넘어가서 자리에와야 청산을 합니다. 그래서 익절할 것도 손절하게 됩니다. 진입봉 및 청산봉은 조건 만들어질때 카운팅 제외된거 같은데 조건에 카운팅되게 부탁드립니다. 예를들어 양양음음 4개봉이 카운팅 되어야 조건만족인데 위 4개봉중 첫번째 양봉이 그전 조건에 진입 및 청산봉이면 카운팅 되지 않고 조건이 완성이 안되네요. 수정 및 보완 부탁드립니다. 그리고 데이터 시뮬레이션상 익절청산시 원래자리에서 청산이 되는게 아니라 더 밀려서 청산되는 경우가 많더라구요. 그래서 정확한 데이터 분석에 어려움이 있는데 이거는 어쩔 수 없는건가요? input : StartTime(101500),EndTime(130000); var : Tcond(false); var : T(0),T1(0),P(0),N(0),B(False),S(False); var : HH(0),HL(0),HM(0),LL(0),LH(0),LM(0),cnt(0); 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 EndTime < StartTime Then SetStopEndofday(0); } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sDate != sDate[1] Then SetStopEndofday(EndTime); } if C > O Then T = 1; if C < O Then T = -1; if T != T[1] Then { T1 = T[1]; } if T == 1 and Condition1 == False and CountIf(C > O and C > C[1],2) == 2 Then { T = 2; P = Index[1]; if T1 == -2 Then { B = False; S = true; LL = L; LH = H; For cnt = 0 to Index-N { if L[cnt] < LL then { LL = L[cnt]; LH = H[cnt]; LM = (LL+LH)/2; } } } Else S = False; } if T == -1 and Condition2 == False and CountIf(C < O and C < C[1],2) == 2 Then { T = -2; N = Index[1]; if T1 == 2 Then { S = False; B = true; HH = H; HL = L; For cnt = 0 to Index-P { if H[cnt] > HH then { HH = H[cnt]; HL = L[cnt]; HM = (HH+HL)/2; } } } Else B = False; } if MarketPosition == 0 and HL > 0 and B == true and NextBarOpen < HL and Tcond == true Then Buy("b",AtStop,HL+PriceScale*3); if MarketPosition == 1 Then { ExitLong("bp",AtLimit,HM[BarsSinceEntry]); ExitLong("bl",AtStop,L[BarsSinceEntry+1]); } if MarketPosition == 0 and LH > 0 and S == true and NextBarOpen > LH and Tcond == true Then Sell("s",AtStop,LH-PriceScale*3); if MarketPosition == -1 Then { ExitShort("sp",AtLimit,LM[BarsSinceEntry]); ExitShort("sl",AtStop,H[BarsSinceEntry+1]); }