Skip to content

[codex] Document indicator warm-up behavior#64

Merged
sdcoffey merged 5 commits into
codex/add-cache-invalidationfrom
codex/document-indicator-warmup
May 29, 2026
Merged

[codex] Document indicator warm-up behavior#64
sdcoffey merged 5 commits into
codex/add-cache-invalidationfrom
codex/document-indicator-warmup

Conversation

@sdcoffey

@sdcoffey sdcoffey commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • update the README quickstart so it does not call a 10-window EMA at index 0
  • document that SMA and EMA emit zero before their first complete window
  • clarify the first calculated index for a 10-period EMA

Related issues

Addresses #49 and #50.

Validation

  • GOCACHE=/private/tmp/techan-gocache mise x go@1.26.3 -- go test ./...

Stacked on #63.

@sdcoffey sdcoffey marked this pull request as ready for review May 29, 2026 15:28
@sdcoffey

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread README.md
}
```

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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@sdcoffey sdcoffey force-pushed the codex/document-indicator-warmup branch from a686623 to 9839f7f Compare May 29, 2026 15:42
@sdcoffey sdcoffey force-pushed the codex/add-cache-invalidation branch from ebfe0d1 to 21d5174 Compare May 29, 2026 15:42
sdcoffey added 2 commits May 29, 2026 08:44
[codex] Make indicator test helper vet-safe
@sdcoffey sdcoffey merged commit 25e6211 into codex/add-cache-invalidation May 29, 2026
1 check passed
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