Exit recovery

How Lune keeps trying to close a position when an exit order fails, so you are never left holding a trade you meant to close.

Markdown
Updated Jul 3, 2026

An exit order can fail. Your broker can reject it, your connection can drop, or the order can time out with no reply. On the entry side a failure just means no trade. On the exit side a failure means a position stays open when you meant to close it. That costs real money.

Exit recovery is the safety net for that case. When a close fails, Lune keeps working to close the position instead of giving up. It is the exit-side counterpart to entry retries.

Note

These settings live on each automation, under order handling. They apply only to exit and close orders, not entries.

How a failed exit is recovered#

When an exit order fails, Lune does not drop it. It adds the close to a recovery queue and retries it with a growing delay between attempts. The first retries come fast, then the gap widens up to a few minutes, so a short broker outage does not turn into a storm of orders.

Recovery also fires the moment your account reconnects. If you lost connection with a position open, Lune retries the queued close as soon as your account shows a sign of life.

1
An exit fails

Your broker rejects the close, or it times out with no reply. Lune queues the exit for recovery.

2
Lune checks and retries

Before each retry, Lune can confirm the position still needs closing, then resends the close. Retries use a growing delay and also trigger on reconnect.

3
Last resort or alert

If retries run out, Lune either sends a flatten to close everything, or alerts you to step in. You choose which.

The safety options#

Exit recoveryOn by defaultOptional

Queues and retries a failed close until the position is gone. Leave this on. Turning it off means one failed close is the end of the attempt, and the position can stay open.

Verify position at brokerOn by defaultOptional

Before each retry, Lune reads your live position at the broker. If the trade is already flat, closed by a stop, a target, a manual click, or an earlier attempt, Lune stops and does not send another order. It also checks the side, so a retry never adds to a position you flipped by hand.

Max exit attemptsDefault 5Optional

How many times Lune retries a close before it gives up. A higher number rides out a longer outage. When attempts run out, Lune moves to your last-resort choice below and alerts you.

Flatten on max attemptsOff by defaultOptional

When retries run out, send a flatten to close every open position on the account as a last resort. Leave this off if you would rather get an alert and close the trade yourself. Turn it on if you want Lune to force the position closed no matter what.

Which options to use#

The defaults are the safe choice for most traders. Keep exit recovery on and verify on, so Lune keeps trying to close the trade and never sends an order for a position that is already flat.

Tip

If you run fully hands-off and want the position forced closed even in a bad outage, turn on flatten on max attempts. If you prefer to make the final call yourself, leave it off and watch for the alert.

When recovery gives up#

A close can fail every attempt, for example if your account stays disconnected the whole time. When that happens Lune stops retrying, saves the failed exit for review, and sends you a critical alert. That last step matters. You want to know a position is still open, and Lune tells you rather than failing in silence.

Was this page helpful?