Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 364992c

Browse filesBrowse files
committed
fix: 笔计算bug
1 parent 5ad4af7 commit 364992c
Copy full SHA for 364992c

1 file changed

+16-4Lines changed: 16 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Bi/BiList.py‎

Copy file name to clipboardExpand all lines: Bi/BiList.py
+16-4Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ def update_bi(self, klc: CKLine, last_klc: CKLine, cal_virtual: bool) -> bool:
5555
else:
5656
return flag1
5757

58+
def can_update_peak(self, klc: CKLine):
59+
if self.config.bi_allow_sub_peak or len(self.bi_list) < 2:
60+
return False
61+
if self.bi_list[-1].is_down() and klc.high < self.bi_list[-1].get_begin_val():
62+
return False
63+
if self.bi_list[-1].is_up() and klc.low > self.bi_list[-1].get_begin_val():
64+
return False
65+
if not end_is_peak(self.bi_list[-2].begin_klc, klc):
66+
return False
67+
if self[-1].is_down() and self[-1].get_end_val() < self[-2].get_begin_val():
68+
return False
69+
if self[-1].is_up() and self[-1].get_end_val() > self[-2].get_begin_val():
70+
return False
71+
return True
72+
5873
def update_bi_sure(self, klc: CKLine) -> bool:
5974
# klc: 倒数第二根klc
6075
_tmp_end = self.get_last_klu_of_last_bi()
@@ -70,10 +85,7 @@ def update_bi_sure(self, klc: CKLine) -> bool:
7085
self.add_new_bi(self.last_end, klc)
7186
self.last_end = klc
7287
return True
73-
elif not self.config.bi_allow_sub_peak and ( \
74-
(self.bi_list[-1].is_down() and klc.high >= self.bi_list[-1].get_begin_val()) or \
75-
(self.bi_list[-1].is_up() and klc.high <= self.bi_list[-1].get_begin_val()) \
76-
):
88+
elif self.can_update_peak(klc):
7789
self.bi_list = self.bi_list[:-1]
7890
return self.try_update_end(klc)
7991
return _tmp_end != self.get_last_klu_of_last_bi()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.