Skip to main content

why your algo didn't flatten or close at the end of the day

edgeful algos flatten at the end of the trading day — no overnight holds. if a position stayed open or closed at the wrong time, it's usually trading-hours/timezone, a paused exit alert, or the position was already closed. here's the checklist.

Written by Brad

what's supposed to happen at the close

most edgeful algos flatten all positions at the end of the trading day or session — no overnight holds. that's by design: it keeps risk contained and your results clean.

so when a position stays open past the close, or the algo flattens at a time you didn't expect, something in the chain is off. it's almost always one of a handful of things — and they're all checkable. work through them in order.

how the end-of-day close works

the flatten isn't a separate button — it's part of the algo's logic, tied to the trading hours you set on the strategy. when the trading-hours window ends, the algo sends an exit to close anything still open. exits go in as market orders, so they prioritize getting you out over getting a perfect price.

that exit reaches your broker the same way every other order does: the algo's alert fires on TradingView, the webhook hits edgeful, and edgeful routes the close to your broker. if any link in that chain is off at the close, the position can stay open.

the #1 cause: trading hours and timezone

this is the one to check first. the end-of-day flatten is tied to the trading-hours window on your strategy — and on TradingView, those times are read in your chart's timezone. if the chart is in a different timezone than you assumed, the flatten fires at a different clock time than you expected.

a quick example: you set the algo to stop at 4:00 PM thinking ET, but your TradingView chart is on exchange time or UTC. the algo still flattens at "4:00" — just not the 4:00 you had in mind. the position looks like it never closed, when really it closed at the wrong clock time, or hasn't hit the window yet.

what to check:

  1. open the strategy in the algo dashboard and confirm the trading-hours end time is what you intend

  2. check the timezone on your TradingView chart (bottom-right of the chart, on the clock) — make sure the hours you set line up with that timezone

  3. remember futures roll to a new trading day at 6:00 PM ET, so a session that runs "overnight" needs its hours set with that boundary in mind

get the trading-hours window and the chart timezone agreeing, and the close fires when you expect it to.

is the exit alert actually firing?

the close can only happen if the alert that carries it is live. a few ways it quietly stops:

  • the TradingView alert is paused — paused alerts don't fire webhooks, so the close never leaves TradingView

  • the alert expired — TradingView alerts expire on their own; check the alerts panel to confirm it's still active

  • you run separate alerts for entry and exit, and only the entry alert is active — the entry fires, the position opens, and nothing is there to close it

  • the webhook URL was removed from the alert message, so the alert fires but nothing reaches edgeful

if you recently paused an algo, make sure you re-enabled every alert tied to it — not just the entry. see how to pause or stop an algo without deleting your strategy for how orphan entries happen.

nothing to flatten: the position was already closed

sometimes the algo did try to close — but there was nothing open, so the broker rejected the exit with "cannot sell when position is 0". that's the broker protecting you: flattening a flat position would open a new trade in the opposite direction.

this usually means one of:

  • the entry never filled — it showed "rejected" or "failed," so there was no position to close

  • you closed it manually in your broker before the algo's close fired

  • your broker or prop firm flattened it first — a daily reset, session close, or risk rule beat the algo to it

match the exit row to its entry row by trade ID in the notification log to see which one it was. the full breakdown is in the algo error message decoder.

delayed data can make the close fire late

if your TradingView charts are on the default ~10-minute delayed feed instead of a real-time CME data subscription, every alert — including the end-of-day close — evaluates on data that's running behind. the flatten can fire late, or against a stale price.

if your closes are consistently a few minutes off, confirm you're on real-time data: enabling real-time CME futures data on TradingView.

broker disconnected at the close

if your broker session expired during the day, the close webhook reaches edgeful but has nowhere to route — you'll see a "failed" status on the exit in the notification log, and the position stays open.

open the algo dashboard, check the connected-accounts table, and reconnect any broker showing disconnected. then close the open position manually so you're not holding it longer than intended.

a recurring or weekly disconnect right before a trade

a different pattern from a one-off drop at the close: the algo disconnects on a regular cadence — often around the weekend — and the connection is down right when your first setup of the week is due to fire. last week's close looked fine, but this week's entry never goes in, because there's no live broker link to route it to.

why it happens: broker and prop-firm sessions don't stay logged in forever. many expire on a cycle — frequently over the weekend market close or a maintenance window — and have to be re-authenticated before they'll accept orders again. if your algo trades early in the week, the session can lapse before that first trade.

how to keep it connected:

  1. reconnect at the start of each trading week, before your first setup is due. open the algo dashboard and confirm the connected-accounts table shows connected, not disconnected.

  2. re-authenticate brokers that require it. some brokers and prop firms expire their session on a schedule and need a fresh login — build that into your weekly routine rather than discovering it mid-trade.

  3. keep the machine running the connection awake. if you route through a local machine or VPS, sleep or standby drops the link — disable sleep on whatever has to stay connected.

  4. check the connection before the session, not after. a quick look at the dashboard before the open tells you whether this week's trade can actually route.

if the connection keeps dropping mid-week with nothing obvious changing, open an in-app chat with the strategy name and the broker you're connecting — that's a pattern worth tracing. and if a trade showed rejected or cancelled on the dashboard while TradingView looked fine, the TradingView to broker execution mismatch guide walks through why.

end-of-day flatten checklist

when a position doesn't close like it should, run these in order:

  1. trading hours + timezone — the strategy's end time matches your TradingView chart timezone

  2. exit alert — the alert is active (not paused or expired), and every alert tied to the strategy is on

  3. notification log — find the exit row: rejected, failed, or "cannot sell when position is 0" each point somewhere different

  4. real-time data — you're not on the ~10-minute delayed feed

  5. broker connection — the broker was connected at the close (and stayed connected through the week — see recurring or weekly disconnect)

if you've worked through all 5 and a position still held overnight, open an in-app chat with the strategy name, the trade date, and a screenshot of the notification log so the team can trace it.

related articles

Did this answer your question?