Skip to content

fix: raise ValueError for RSI/ATR period < 1#3

Open
santhreal wants to merge 1 commit into
VibeTradingLabs:mainfrom
santhreal:fix/rsi-atr-zero-period-zerodivision
Open

fix: raise ValueError for RSI/ATR period < 1#3
santhreal wants to merge 1 commit into
VibeTradingLabs:mainfrom
santhreal:fix/rsi-atr-zero-period-zerodivision

Conversation

@santhreal

Copy link
Copy Markdown

rsi() and atr() divide by period with no guard, so period=0 raises ZeroDivisionError. Reject period < 1 with ValueError; period=1 still works.

period=0 caused ZeroDivisionError in the Wilder ewm alpha (1/period).
Match ema/macd, which already reject non-positive spans with ValueError.
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

Successfully merging this pull request may close these issues.

1 participant