Skip to content

Commit

Permalink
Merge pull request #21 from joshyattridge/fix_overlapping_bos_choch
Browse files Browse the repository at this point in the history
prevented bos and choch from overlapping
  • Loading branch information
joshyattridge authored Apr 21, 2024
2 parents b799767 + ae98da3 commit 0b0b487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
dist
smartmoneyconcepts.egg-info
.DS_Store
.DS_Store
__pycache__
6 changes: 6 additions & 0 deletions smartmoneyconcepts/smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ def bos_choch(cls, ohlc: DataFrame, swing_highs_lows: DataFrame, close_break:boo
if np.any(mask):
j = np.argmax(mask) + i + 2
broken[i] = j
# if there are any unbroken bos or choch that started before this one and ended after this one then remove them
for k in np.where(np.logical_or(bos != 0, choch != 0))[0]:
if k < i and broken[k] >= j:
bos[k] = 0
choch[k] = 0
level[k] = 0

# remove the ones that aren't broken
for i in np.where(
Expand Down

0 comments on commit 0b0b487

Please sign in to comment.