커뮤니티

수식 문의 드립니다.

프로필 이미지
blueo
2020-10-01 20:37:55
1134
글번호 142807
답변완료

첨부 이미지

안녕하세요 담당자님 우선 감사 드립니다. 제가 이전 직무재그 50%를 기준으로 매수나 매도 시스템을 만들고 싶은데 아래와 같이 했을때 안되서요 확인 부탁 드립니다. 예로 매수는 이전하락 지그재그의 50%를 돌파시 매수 매도는 이전 상승 지그재그의 50%를 돌파시 매도 이런 식으로 할려고 합니다. Input:chngRate(0.1); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H; Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0); If Condition1 Then { lastHiVal = H; lastLoVal = 0; } If Condition2 Then { lastLoVal = L; lastHiVal = 0; } turnPntBit = ""; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; If turnPntBit <> "" Then { If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; TL_SetEnd(TL1,sDate[barArr[1]+20],sTime[barArr[1]+20],valArr[1]); If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; If turnPntArr[1][1] <> turnPntArr[1][0] Then{ TL1 = TL_New(sDate[barArr[2]+20],sTime[barArr[2]+20],valArr[2],sDate[barArr[1]+20],sTime[barArr[1]+20],valArr[1]); if crossup (c,(((turnPntArr[2][1] =="Lo")-(turnPntArr[1][0]=="Hi"))/2)) Then{ buy(); } if crossdown(c,(((turnPntArr[2][1] =="Lo")-(turnPntArr[3][2] =="Hi")/2)) Then{ sell(); } } Else TL_SetEnd(TL1,sDate[barArr[1]+18],sTime[barArr[1]+18],valArr[1]); } } TL_SetSize(TL1,2); TL_SetColor(TL1,blue);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-10-05 13:35:38

안녕하세요 예스스탁입니다. Input:chngRate(0.1); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),T(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H; Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0); If Condition1 Then { lastHiVal = H; lastLoVal = 0; } If Condition2 Then { lastLoVal = L; lastHiVal = 0; } turnPntBit = ""; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; If turnPntBit <> "" Then { If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; TL_SetEnd(TL1,sDate[barArr[1]+20],sTime[barArr[1]+20],valArr[1]); If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; If turnPntArr[1][1] <> turnPntArr[1][0] Then { TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]); } Else TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); } } TL_SetSize(TL1,2); TL_SetColor(TL1,blue); if turnPntArr[1][0]== "Hi" Then T = 1; if turnPntArr[1][0]== "Lo" Then T = -1; if T == 1 and CrossUp(C,(valarr[2]+valArr[3])/2) Then Buy(); if T == -1 and CrossDown(C,(valarr[2]+valArr[3])/2) Then Sell(); 즐거운 하루되세요 > blueo 님이 쓴 글입니다. > 제목 : 수식 문의 드립니다. > 안녕하세요 담당자님 우선 감사 드립니다. 제가 이전 직무재그 50%를 기준으로 매수나 매도 시스템을 만들고 싶은데 아래와 같이 했을때 안되서요 확인 부탁 드립니다. 예로 매수는 이전하락 지그재그의 50%를 돌파시 매수 매도는 이전 상승 지그재그의 50%를 돌파시 매도 이런 식으로 할려고 합니다. Input:chngRate(0.1); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H; Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0); If Condition1 Then { lastHiVal = H; lastLoVal = 0; } If Condition2 Then { lastLoVal = L; lastHiVal = 0; } turnPntBit = ""; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; If turnPntBit <> "" Then { If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; TL_SetEnd(TL1,sDate[barArr[1]+20],sTime[barArr[1]+20],valArr[1]); If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; If turnPntArr[1][1] <> turnPntArr[1][0] Then{ TL1 = TL_New(sDate[barArr[2]+20],sTime[barArr[2]+20],valArr[2],sDate[barArr[1]+20],sTime[barArr[1]+20],valArr[1]); if crossup (c,(((turnPntArr[2][1] =="Lo")-(turnPntArr[1][0]=="Hi"))/2)) Then{ buy(); } if crossdown(c,(((turnPntArr[2][1] =="Lo")-(turnPntArr[3][2] =="Hi")/2)) Then{ sell(); } } Else TL_SetEnd(TL1,sDate[barArr[1]+18],sTime[barArr[1]+18],valArr[1]); } } TL_SetSize(TL1,2); TL_SetColor(TL1,blue);