twopirllc / pandas-ta

Technical Analysis Indicators - Pandas TA is an easy to use Python 3 Pandas Extension with 150+ Indicators
https://twopirllc.github.io/pandas-ta/
MIT License
5.23k stars 1.02k forks source link

Arms Index (TRIN) #382

Open reza1615 opened 3 years ago

reza1615 commented 3 years ago

Hi, Would you please add Arms Index (TRIN) as an indicator?

twopirllc commented 3 years ago

@reza1615,

Sure. Currently I do not have implementation time. So hopefully someone is willing to help making a PR and contribute.

Kind Regards, KJ

ramgarg102 commented 3 years ago

Hi @twopirllc , can I take up this issue. @reza1615, could you just tell me under which category Arms Index (TRIN) indicator comes? image

reza1615 commented 3 years ago

I couldn't find its category. Base on the definition page. it is a overal market sentiment. In my opinion it should be under performance or momentum like rsi it shows overbought

twopirllc commented 3 years ago

Hello @reza1615 and @ramgarg102,

Base on the definition page. it is a overal market sentiment.

After double checking trin, it is classified as a Market Sentiment or Comparative Analysis indicator just like the Price Relative Indicator in Issue #161. It is more of "macro" indicator that utilizes two or more symbols/tickers and thus can not be included as a DataFrame Extension indicator like all the others df.ta.sma(), df.ta.sma(), et al. All the normal categorical indicators work for a single DataFrame ticker/symbol.

However I am not opposed to including trin and #161. They will need their own Category likely named comparative. Also, it should be noted that it is the user's responsibility to manually pd.concat the results on their own if needed.

Thoughts?

KJ

ramgarg102 commented 3 years ago

Hello @twopirllc

Why would the users need to manually use pd.concat() if they can use (suppose we add Trin) df.ta.trin(append=True)?

Does Trin being dependent on other indicators has something to do with it?

twopirllc commented 3 years ago

@ramgarg102

Does Trin being dependent on other indicators has something to do with it?

No.

Why would the users need to manually use pd.concat() if they can use (suppose we add Trin) df.ta.trin(append=True)?

Well a Pandas TA DataFrame is meant to represent a single ticker/symbol whereas trin depends on a basket of symbols as I described in my previous comment. TRIN typically aggregates all 500 symbols of the S&P 500 index or 50 for the Nifty 50, as detailed in the Quantinsti python code.

So in my mind it makes sense to exclude as a DataFrame Extension method. But if it were included as a DataFrame Extension method df.ta.trin(append=True) it will need to be excluded from df.ta.strategy() (but that's a simple fix).

KJ

ramgarg102 commented 3 years ago

So, finally what to do?

twopirllc commented 3 years ago

@ramgarg102,

Either implement it, wait for it to be implemented, or implement in your own forked repo. Up to you.

KJ