커뮤니티

부탁 드립니다.

프로필 이미지
yes
2015-07-19 12:07:58
193
글번호 88622
답변완료

첨부 이미지

그림과 같이 수평선 2개(적색 흑색) 부탁 드립니다. 아울러 아래의 흑색선은 추세선이 완성 되기 이전까지 실시간으로 변동 될수 있도록 부탁 드립니다. Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),tx(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Highest(H,52) == H and lastHiVal <> H; Condition2 = Lowest(L,52) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; 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]],sTime[barArr[1]],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{ Tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],NumToStr(valArr[2],2)); Text_SetStyle(tx,2,2); 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[1],3); TL_SetColor(TL1[1],RGB(20,255,255));
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2015-07-20 12:59:10

안녕하세요 즐거운 하루되세요 Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),tx(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Highest(H,52) == H and lastHiVal <> H; Condition2 = Lowest(L,52) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; 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]],sTime[barArr[1]],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{ Tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],NumToStr(valArr[2],2)); Text_SetStyle(tx,2,2); 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[1],3); TL_SetColor(TL1[1],RGB(20,255,255)); var : TL11(0),TL12(0),Tx1(0),tx2(0),V1(0),V2(0); if turnPntArr[1][0] == "Hi" Then{ TL_Delete(TL11); TL11 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[1],sDate[barArr[1]],sTime[barArr[1]],valArr[1]); TL_SetExtRight(TL11,true); TL_SetColor(TL11,red); TL_SetSize(TL11,3); TL_SetEnd(TL11,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); } if turnPntArr[1][0] == "Lo" Then{ TL_Delete(TL12); TL12 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[1],sDate[barArr[1]],sTime[barArr[1]],valArr[1]); TL_SetExtRight(TL12,true); TL_SetColor(TL12,BLACK); TL_SetSize(TL12,3); TL_SetEnd(TL12,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); } 즐거운 하루되세요 > yes 님이 쓴 글입니다. > 제목 : 부탁 드립니다. > 그림과 같이 수평선 2개(적색 흑색) 부탁 드립니다. 아울러 아래의 흑색선은 추세선이 완성 되기 이전까지 실시간으로 변동 될수 있도록 부탁 드립니다. Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),tx(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Highest(H,52) == H and lastHiVal <> H; Condition2 = Lowest(L,52) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; 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]],sTime[barArr[1]],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{ Tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],NumToStr(valArr[2],2)); Text_SetStyle(tx,2,2); 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[1],3); TL_SetColor(TL1[1],RGB(20,255,255));