andredumas / techan.js

A visual, technical analysis and charting (Candlestick, OHLC, indicators) library built on D3.
http://techanjs.org/
MIT License
2.41k stars 534 forks source link

RSI calculation enhancement #109

Open smiahmed opened 8 years ago

smiahmed commented 8 years ago

Hi; I was trying to implement RSI chart and was having difficulty in spotting the problem as my spread and RSI chart seems to give different numbers.

You can see the RSI value in chart is below 30 while worksheet is giving me a value of 37.83 on Dec 23, 2015. Can you please help me understand what is causing this discrepancy.

Thanks.

image

and here is the worksheet:

image

priikone commented 8 years ago

I think this is beacuse RSI in techan uses EMA instead of what would be a rolling moving average used in the traditional RSI. I've noticed this as well and it's especially noticeable when using RSI in stochRSI indicator, which I've implemented, and the end result is wildly different from normal stochRSI.

andredumas commented 8 years ago

I can't recall why I used ema, I think it's traditionally what i've always used.

Looking it up in more detail there's a bit of contradiction on the correct method. Some say simple moving average, other's wilder's smoothing with a sma as initial. The correction would be fairly straight forward, but the correct correction would be the decision.

davydof commented 5 years ago

@andredumas hello, any updates? probably better to get the ability to use any kind of MA instead of only one EMA?

my goal is to implement usual RSI