Skip to content

Fix indicator, cache, and trading analysis regressions - #69

Merged
sdcoffey merged 2 commits into
mainfrom
dev/steve/fix-indicator-and-analysis-regressions
Sep 4, 2026
Merged

Fix indicator, cache, and trading analysis regressions#69
sdcoffey merged 2 commits into
mainfrom
dev/steve/fix-indicator-and-analysis-regressions

Conversation

@sdcoffey

@sdcoffey sdcoffey commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Indicator composition could seed averages with warm-up placeholders, retain stale values after candle edits, and accumulate quadratic EMA/MMA memory usage. Several indicator, crossover, and trade-analysis edge cases also produced incorrect results. This fixes the audit findings while retaining Go 1.21 and the existing module dependencies.

Changes

  • Calculate EMA/MMA histories iteratively with cached state rounded to 256-bit precision. Add FirstValidIndex metadata and propagate cache invalidation through built-in indicator dependencies.
  • Correct crossover events across equality plateaus, chronological maximum drawdown, CCI typical-price deviation, Aroon evaluation order and tied extremes, Bollinger warm-up, and Wilder RSI initialization.
  • Correct directional profit reporting, fractional-period returns, buy-and-hold candle horizons, and the strategy warm-up boundary. Validate malformed and reversed time periods without panicking.
  • Move test helpers out of production builds, make fixtures deterministic, repair and test the examples, pin developer tools, and add Go 1.27 and lint checks to CI.

Calculation fixes can change existing indicator values, trading signals, and analysis results. EMA/MMA now retain roughly 77 significant decimal digits rather than growing precision indefinitely. The README and changelog document these conventions, cache reset requirements, and return-calculation assumptions.

Related reports: #18, #25, #53, #49, #50, and #13.

Validation

  • Race-enabled tests pass on Go 1.21.13, 1.26.3, and 1.27.1; vet passes on the minimum and latest versions, and make lint passes with pinned Staticcheck.
  • Go 1.21 tests on the current macOS host used -ldflags=-linkmode=external to avoid the old internal linker's missing LC_UUID issue.
  • Parser fuzzing passed for 10 seconds (31,676 executions).
  • Regression tests cover composition, candle mutation and reindexing, precision and numeric scale, indicators, crossovers, trade analysis, parser validation, and strategy boundaries.
  • EMA/MMA history benchmarks at 400, 800, and 1,600 samples show approximately linear allocation growth. A local 1,600-sample EMA reproduction reduced retained heap from about 82.5 MiB to 0.26 MiB.
  • git diff --check passes; go.mod and go.sum are unchanged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T22:56:55.454522Z 8fdcfa4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 8fdcfa4c78

ℹ️ 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 indicator_composition.go
Comment thread timeperiod.go Outdated
@sdcoffey
sdcoffey merged commit a98d2de into main Sep 4, 2026
8 checks 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