New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connors RSI? #450
Comments
https://school.stockcharts.com/doku.php?id=technical_indicators:connorsrsi
That has a formula, looks pretty straightforward?
… On Aug 23, 2021, at 7:32 AM, mayhem7 ***@***.***> wrote:
Hi guys, first of all thanks for this awesome library!
I can't find Connors RSI in the indicators, is there any plan to implement it or anyway to do it by myself using this library?
Thanks gain!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I tried, but i don't know how to calculate the "Streak" thing or the "PercentRank"... |
This is not verified, but maybe you can use it as a starting point. import numpy as np
import talib as ta
import pandas as pd Using this suggestion here: https://stackoverflow.com/questions/66371344/streak-count-below-0 You can make a "streaks" calculator: def STREAKS(a):
df = pd.DataFrame(a)
lt = df[0] < df[0].shift(1)
eq = df[0] == df[0].shift(1)
def count(x):
n = 0 if count.called == 0 or eq[count.sum] else 1
r = np.arange(n, len(x) + n)
if count.called % 2 == 1:
r = -r
count.called += 1
count.sum += len(x)
return pd.Series(r, x.index)
count.called = 0
count.sum = 0
return np.array(df.groupby((lt != lt.shift(1)).cumsum()).apply(count), dtype=float) And a percentile rank function, maybe something like this: def PERCENTRANK(a, n):
x = np.array([sum(a[i+1-n:i+1] < a[i]) / n for i in range(len(a))])
x[:n-1] = np.nan
return x And then putting it together: def CONNORSRSI(a, x, y, z):
return (ta.RSI(a, x) + ta.RSI(STREAKS(a), y) + PERCENTRANK(a, z)) / 3 And using it (similar to the link I posted): CONNORSRSI(c, 3, 2, 10) I didn't really verify it's 100% correct... |
Thanks i'l ltry! <3 |
Hi guys, first of all thanks for this awesome library!
I can't find Connors RSI in the indicators, is there any plan to implement it or anyway to do it by myself using this library?
Thanks gain!
The text was updated successfully, but these errors were encountered: