[codex] Document indicator warm-up behavior#64
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a68662383a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| ``` | ||
|
|
||
| Windowed indicators such as SMA and EMA return `0` until enough data exists to fill their first window. For example, a 10-period EMA starts producing calculated values at index `9`. |
There was a problem hiding this comment.
Don't document EMA warm-up as unconditional
This new statement is not true for all EMA windows. NewEMAIndicator starts with a 1000-entry cache, and returnIfCached expands and falls through whenever index >= len(cache) before it checks index < windowSize()-1, so a call like NewEMAIndicator(ind, 2000).Calculate(1500) will read the underlying indicator and recurse instead of returning zero even though the first complete window is not available. That can give users wrong guidance, and with a shorter series it can still panic instead of returning the documented zero.
Useful? React with 👍 / 👎.
a686623 to
9839f7f
Compare
ebfe0d1 to
21d5174
Compare
[codex] Make indicator test helper vet-safe
[codex] Harden analysis edge cases
Summary
Related issues
Addresses #49 and #50.
Validation
Stacked on #63.