
public event Action<Position> PositionClosingFailEvent;
The PositionClosingFailEvent informs of a failed attempt to close a position.
Unlike issues with opening positions, a closing error can lead to financial losses, so it is advisable to use this event in every algorithm to solve the problem promptly. Closing position errors can be caused by external factors, such as an order execution error, a disconnection from the exchange; or by the robot's actions – cancelling the closing order.
Consider the following example. There is an algorithm that opens positions using limit orders. Often, these limit orders do not get executed and are cancelled by the robot.

1. Subscribe to the PositionClosingFailEvent.
2. In the handler, obtain a reference to the last closing order.
3. If the order's state is OrderStateType.Fail, it means it was rejected by the exchange for some reason, and the user must be informed.
4. If its state is OrderStateType.Cancel, it means the order was cancelled, then close the position at the market.
If you have any difficulties or questions, please write to the support chat. Link