trading-signals icon indicating copy to clipboard operation
trading-signals copied to clipboard

Feature Request: Relative Moving Average (RMA)

Open ozum opened this issue 1 year ago • 3 comments

Hi,

Thanks for this well-thought library.

Is it possible to add RMA to the library and support it in DMI and ADX? TradingView uses RMA in indicators such as DX, ADX, etc.

I use TradingView to check my strategies visually and then code them in Node.js. The lack of RMA causes different results for DMI and ADX in my scripts.

Below is the Pine Script code for RMA taken from TradingView:

pine_rma(src, length) =>
    alpha = 1/length
    sum = 0.0
    sum := na(sum[1]) ? ta.sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])

Thanks in advance,

ozum avatar Apr 14 '24 15:04 ozum

Hi @ozum,

We can add the Relative Moving Average (RMA) to this library. A reference implementation in Pine Script is already helpful. Do you have a link to a PDF document describing the algorithm behind it? What would also help are test vectors (test scripts of other libraries that have it already implemented).

bennycode avatar Apr 16 '24 09:04 bennycode

Not an official document, but this page contains a description and formula.

ozum avatar Apr 16 '24 09:04 ozum

This helps a lot, thanks! Is it actually different to a Rolling Moving Average?

bennycode avatar Apr 16 '24 09:04 bennycode