GithubHelp home page GithubHelp logo

Comments (4)

hchaudhary1 avatar hchaudhary1 commented on August 25, 2024 1

You can look at the Pandas TA code as well:
https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/momentum/rsi.py

This matches very close to TA-Lib

from indicators.jl.

dysonance avatar dysonance commented on August 25, 2024

@Sinansi Thanks for raising this, I appreciate the detailed question. Some of the difference may come from having different default conventions for computing the moving average for the relative strength. It seems like the TA-Lib function uses simple moving average, where the default for the Indicators rsi function is exponential moving average. I tried an experiment using rsi(px, n=14, ma=sma) and got somewhat closer, though it still doesn't perfectly replicate the TA-Lib result.

I'm having trouble discerning from the TA-Lib docs/source what the source of the difference might be. Would you happen to have a sample of RSI code that replicates the TA-Lib result that I can compare with? Happy to dive in and figure out the disconnect, but if you have a starting point from which I can compare methodology that would help a great deal.

from indicators.jl.

Sinansi avatar Sinansi commented on August 25, 2024

@dysonance thanks for the reply!

Indeed, you are correct. I totally forgot that some implementations of RSI, internally adds a smoother to the raw indicator.

I found some source code of TA-Lib in C, and they dont use SMA neither EMA. They internally apply Welles Wilder's Moving Average, which is slightly different from than the traditional moving averages.

Here is the Welles Wilder Moving Average, Quote from (www.incrediblecharts.com)

The standard exponential moving average formula converts the time period to a fraction using the formula EMA% = 2/(n + 1) where n is the number of days. For example, the EMA% for 14 days is 2/(14 days +1) = 13.3%. Wilder, however, uses an EMA% of 1/14 which equals 7.1%. This equates to a 27-day exponential moving average using the standard formula.

This is why comparing Indicators.rsi with Talib.RSI give slightly different correlation.

from indicators.jl.

Sinansi avatar Sinansi commented on August 25, 2024

@dysonance I wanted to send you a link for TALib source code as requested, but their website is broken. I have sent you the source code by email.

from indicators.jl.

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.