Skip to content

Relative Strength Index (RSI) Indicator always equal to 1.0 when inputs greater than initial #2673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bartlaw opened this issue May 28, 2025 · 0 comments

Comments

@bartlaw
Copy link

bartlaw commented May 28, 2025

Bug Report

If the first price in series is the smallest one, the RSI indicator will always have a value of 1.0.
This happens when the rest of the price is bigger than the first price. RSI has to be brand new (has_inputs==False)

Expected Behavior

Indicator should have values < 1.0 eventually.

Actual Behavior

Indicator have values equal to 1.0.

Steps to Reproduce the Problem

Feed indicator with series with the smallest price at the beginning.

Code Snippets or Logs

Maybe _last_value should be assigned in (rsi.pyx:102):

if self._average_loss.value == 0:
    self.value = self._rsi_max
    return

Workaround that works for me:

        if self.rsi.value == 1.0 and not self.rsi.initialized:
            self.invalid_rsi_counter += 1
            if self.invalid_rsi_counter > 5:
                self.rsi.reset()
                self.invalid_rsi_counter = 0

Specifications

  • OS platform: Windows
  • Python version: 3.12
  • nautilus_trader version: 1.218.0a20250516
@cjdsellers cjdsellers changed the title Relative Strength Index (RSI) Indicator always equal to 1.0 Relative Strength Index (RSI) Indicator always equal to 1.0 when inputs greater than initial May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant