3 changed files with 40 additions and 0 deletions
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
|
||||
import numpy as np |
||||
|
||||
def Highest(data, period): |
||||
result = np.zeros(len(data)) |
||||
if len(result) == 0: |
||||
return result |
||||
result[0] = data[0] |
||||
for i in range(1, len(data)): |
||||
result[i] = max(data[max(0, i - period):(i+1)]) |
||||
|
||||
return result |
||||
|
||||
def HighestValue(data, index, period): |
||||
if len(data) == 0 or index >= len(data): |
||||
return None |
||||
if index == 0: |
||||
return data[0] |
||||
return max(data[max(0, index - period):(index+1)]) |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
|
||||
import numpy as np |
||||
|
||||
def Lowest(data, period): |
||||
result = np.zeros(len(data)) |
||||
if len(result) == 0: |
||||
return result |
||||
result[0] = data[0] |
||||
for i in range(1, len(data)): |
||||
result[i] = min(data[max(0, i - period):(i+1)]) |
||||
|
||||
return result |
||||
|
||||
def LowestValue(data, index, period): |
||||
if len(data) == 0 or index >= len(data): |
||||
return None |
||||
if index == 0: |
||||
return data[0] |
||||
return min(data[max(0, index - period):(index+1)]) |
||||
Loading…
Reference in new issue