Skip to content

Position stuck on close when using trailing close #509

@deniss-muhla

Description

@deniss-muhla

Sometimes, the bot fails to close a position when both grid close and trailing close are configured sequentially.
close_trailing_grid_ratio > 0
The issue occurs during live trading, but not in backtests.

Expected Behavior:

  1. Grid-based closing.
  2. If conditions are met, engage trailing close.

Actual Behavior:

  1. Grid-based closing.
  2. No trailing close orders. The position remains open ("stuck") even after trailing close conditions are met.

This does not happen in backtests.

Likely cause: during the wait for trailing conditions, the wallet balance slightly increases (due to opposite direction position making profit), which might affect the calculated close size or minimum order constraints.

As soon as the "stuck" position is reduced manually by the minimum amount allowed by the trading platform, the trailing close order is immediately executed.

Environment:
Exchange: Bybit
Mode: Live
Bot config: close_trailing_grid_ratio > 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions