[codex] Fix stop-loss price basis#61
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f1be15cf7
ℹ️ 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".
|
|
||
| loss := currentPrice.Div(entryPrice).Sub(big.ONE) | ||
| if entryOrder.Side == SELL { | ||
| loss = entryPrice.Div(currentPrice).Sub(big.ONE) |
There was a problem hiding this comment.
Trigger short stop losses at the configured percentage
For short positions, this computes the loss as entryPrice/currentPrice - 1, which uses the current price as the denominator instead of the entry price. With a short entered at 100 and a -5% tolerance, a close at 105 should satisfy the rule because the loss is 5% of entry, but this formula yields about -4.76% and does not trigger until roughly 105.26, delaying stop-loss exits for shorts.
Useful? React with 👍 / 👎.
1f1be15 to
0abd685
Compare
[codex] Make indicator test helper vet-safe
[codex] Harden analysis edge cases
[codex] Document indicator warm-up behavior
[codex] Add indicator cache invalidation
[codex] Guard trendline slope for sparse windows
Summary
Related issues
Fixes #8.
Validation
Stacked on #60.