|
2 | 2 |
|
3 | 3 | if importlib.util.find_spec("scipy") is None \ |
4 | 4 | or importlib.util.find_spec("tulipy") is None \ |
5 | | - or importlib.util.find_spec("numpy") is None \ |
6 | | - or importlib.util.find_spec("collections") is None: |
7 | | - raise ImportError("You have not installed the the indicators package") |
8 | | - |
| 5 | + or importlib.util.find_spec("numpy") is None: |
| 6 | + raise ImportError("You have not installed the indicators package") |
9 | 7 |
|
10 | 8 | from scipy.signal import argrelextrema |
11 | 9 | from collections import deque |
@@ -114,21 +112,23 @@ def get_lower_lows(data: np.array, order=5, K=2): |
114 | 112 | Must not be exceeded within the number of periods indicated by the width |
115 | 113 | parameter for the value to be confirmed. |
116 | 114 |
|
117 | | - params: |
118 | | -
|
119 | | - order : int, optional |
120 | | - How many points on each side to use for the comparison |
121 | | - to consider ``comparator(n, n+x)`` to be True. |
122 | | -
|
123 | | - K : int, optional |
124 | | - How many consecutive lows need to be lower. This means that for |
125 | | - a given low, the next |
126 | | - K lows must be lower than the k lows before. So say K=2, then |
127 | | - the low at index i must be lower than the low at |
128 | | - index i-2 and i-1. If this |
129 | | - condition is met, then the low at index i is considered a |
130 | | - lower low. If the condition is not met, then the low at |
131 | | - index i is not considered a lower low. |
| 115 | + Parameters: |
| 116 | +
|
| 117 | + order (optional): int - How many points on each |
| 118 | + side to use for the comparison to |
| 119 | + consider ``comparator(n, n+x)`` to be True. |
| 120 | + K (optional): int - How many consecutive lows need |
| 121 | + to be lower. This means that for a given low, |
| 122 | + the next K lows must be lower than the k lows |
| 123 | + before. So say K=2, then the low at index i must |
| 124 | + be lower than the low at index i-2 and i-1. If this |
| 125 | + condition is met, then the low at index i is considered a |
| 126 | + lower low. If the condition is not met, then the low at |
| 127 | + index i is not considered a lower low. |
| 128 | +
|
| 129 | + Returns: |
| 130 | + extrema: list - A list of lists containing the indices of the |
| 131 | + consecutive lower lows in the data array. |
132 | 132 | ''' |
133 | 133 | # Get lows |
134 | 134 | low_idx = argrelextrema(data, np.less, order=order)[0] |
|
0 commit comments