Last active
August 10, 2018 07:18
-
-
Save fieldAbyss/506f2eb9dcd9e6f0323b987ab1ee234e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RCI | |
def RCI(seq, itv): | |
def ord(seq, idx, itv): | |
p = seq[idx] | |
o = 1 | |
for i in range(itv - 1): | |
if p < seq[i]: | |
o += 1 | |
return o | |
def d(seq, itv): | |
sum = 0 | |
for i in range(itv - 1): | |
sum += pow((i + 1) - ord(seq, i, itv), 2) | |
return sum | |
return (1 - 6 * d(seq, itv) / (itv * (itv ** 2 - 1))) * 100 | |
period = 9 | |
rci = RCI(np_close, period) | |
print(rci) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment