Code Monkey home page Code Monkey logo

Comments (6)

twopirllc avatar twopirllc commented on May 14, 2024 1

Hello @Vesnog,

Standard literature for RSI has a default length of 14 including most platforms as well as this library.

STOCHRSI is the result of applying STOCH to RSI or in otherwords STOCHRSI = STOCH(RSI). If you believe STOCHRSI has significance then use it, if not then do not include it. Same with any other indicator. Only you can make that determination.

You shouldn't have to call them that way. You are including kwargs in RSI that serve no purpose. Recall that you can use help(ta.rsi) or help(ta.stochrsi) to list the available args and kwargs.

Here are some ways of calling the indicators you listed above:

Standard

import pandas as pd
import pandas_ta as ta

bars_df = # ohlcv data
bars_df["stochrsi7"] = ta.stochrsi(bars_df.close, length=7)
bars_df["rsi14"] = ta.stochrsi(bars_df.close)
bars_df["rsi24"] = ta.stochrsi(bars_df.close, length=24)

Pandas TA DataFrame

import pandas as pd
import pandas_ta as ta

bars_df = # ohlcv data
bars_df.ta.stochrsi(length=7, append=True)
bars_df.ta.stochrsi(append=True)
bars_df.ta.stochrsi(length=24, append=True)

Pandas TA Strategy

import pandas as pd
import pandas_ta as ta

bars_df = # ohlcv data

# (1) Create the Strategy
RSIStrategies = ta.Strategy(
    name="RSI and STOCHRSI",
    ta=[
        {"kind": "stochrsi", "length": 7},
        {"kind": "rsi"},
        {"kind": "rsi", "length": 24},
    ]
)

# (2) Run the Strategy
bars_df.ta.strategy(RSIStrategies)

Hope this helps and makes sense!

Kind Regards,
KJ

from pandas-ta.

twopirllc avatar twopirllc commented on May 14, 2024

Hi @homily,

Currently rsi has at least 99% correlation with TA Lib, so it is not a high priority right now.

That being said, I do not mind adding a TradingView version, but it is more difficult to test against as they do not have an easily testable library. If you know of a better and quicker way to test and compare vs TradingView, let me know what needs to be modified so that it matches TradingView.

Differences in languages (Python and Pinescript in this case) and how they handle decimals/floats can easily cause minor differences in calculations. What is the current correlation between pandas-ta and TradingView's rsi?

Regards,
KJ

from pandas-ta.

homily avatar homily commented on May 14, 2024

Yes, thank you very much.

I've been using your library and it's very convenient.

I think it is very necessary to add tradingview. After all, there are many open scripts written with pin script. If tradingview can be effectively supported, it will be greatly convenient for all users.

from pandas-ta.

twopirllc avatar twopirllc commented on May 14, 2024

Heya @homily,

Thank you!

Also, thanks for your patience. Yes, I do like TradingView and some of my own TV indicators are also incorporated in Pandas TA. If think the differences you may be seeing are the may be the differences in data sources; TV's data source and your data source may not be the same. Computationally, they are the same.

Thanks,
KJ

from pandas-ta.

twopirllc avatar twopirllc commented on May 14, 2024

@homily,

Revamped stoch added stochrsi. Both are inline with TradingView.
Use help(ta.stoch) and help(ta.stochrsi) for more info.

Thanks,
KJ

from pandas-ta.

Vesnog avatar Vesnog commented on May 14, 2024

Hello,

What are the default parameters to get the same RSI reading in Binance, TradingView and this library? I am pretty confused with various methods for calculation of RSI and I really appreciate and explanatory answer. Library version is '0.2.45b0'. I call them in the following manner to compare directly with Binance:

    bars_df['rsi7'] = ta.stochrsi(bars_df.close, length=7, rsi_length=14, k=3, d=3)
    bars_df['rsi14'] = ta.rsi(bars_df.close, length=14, rsi_length=14, k=3, d=3)
    bars_df['rsi24'] = ta.rsi(bars_df.close, length=24, rsi_length=14, k=3, d=3)

from pandas-ta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.