Skip to content

Session Management

A trading session is the container that manages everything about a live trading run: the strategy being executed, the broker connection, the data feed, the risk controls, and the current state of all positions and orders. Understanding how sessions work gives you full control over your live trading experience.

Every trading session moves through a defined set of states. At any moment, your session is in exactly one of these states:

State Meaning
Queued Session is waiting to start (e.g., scheduled for market open).
Starting Initializing strategy config, loading historical data for indicator warmup, validating risk settings.
Running Fully active. Strategy evaluates conditions on every bar and submits orders. Normal operating state.
Idle Automatic, system-managed. The session’s market is closed, so evaluation is suspended. Positions and working orders remain at your broker. Not billed. Resumes automatically shortly before market open.
Stopping Orderly shutdown in progress: canceling orders, optionally flattening positions, disconnecting.
Stopped Fully shut down. No activity. History preserved. Can start a new session from the same config.
Emergency Stopped Force-killed. All orders canceled, all positions closed at market. Recorded separately so history clearly shows this was not a normal stop.
Error Session encountered a fatal condition it could not recover from. Review the event log, fix the root cause, then start a new session.

When you start a session, it moves through Starting automatically:

  • Loads your strategy configuration (rules, parameters, instruments).
  • Connects to the market data feed and begins receiving real-time prices.
  • Loads historical data for indicator warmup (so indicators like moving averages are accurate from the first bar).
  • Validates your risk management settings.
  • Authenticates with the broker API, verifies account permissions and buying power, and synchronizes any existing positions.

This typically takes a few seconds. If the broker connection fails (for example, due to expired credentials), the session moves to Error with a message about what went wrong.

The session is fully active. Your strategy is evaluating conditions on every new data point and submitting orders to your broker when signals trigger.

While running, you can monitor:

  • Current open positions and their unrealized P&L
  • Pending orders waiting to be filled
  • Recent trade history
  • Risk limit usage (how close you are to your position, loss, or drawdown limits)
  • Data feed health and broker connection status

Idle is an automatic, system-managed state — you never trigger it directly. When your session’s market closes (based on its Market Hours mode — RTH only, RTH + ETH, or 24/7), Stratifyre suspends strategy evaluation and moves the session to Idle.

While Idle:

  • No new orders are submitted — evaluation is fully suspended.
  • Your positions and any working orders remain exactly as they are at your broker.
  • The session is not billed for the time it spends Idle.
  • The session still counts toward your plan’s concurrent-session limit — your slot is reserved so it can resume automatically.
  • Shortly before the market reopens, Stratifyre automatically resumes the session, returning it to Running with no action required from you.

A session with a 24/7 Market Hours mode (for example, most crypto strategies) never goes Idle, since its market never closes.

Something went wrong that prevents the session from continuing. Common causes:

  • Broker connection lost and could not be re-established after auto-recovery attempts.
  • Data feed disconnection that exceeded the stale-data timeout.
  • A risk or drawdown limit breach that triggered an automatic Emergency Stop, which itself could not complete cleanly.
  • An internal error in the strategy evaluation engine.

When a session enters the Error state, Stratifyre cancels all pending orders (if possible), sends you an immediate notification through all configured alert channels, and logs full details. You will need to review the event log, address the root cause, and start a fresh session.

  1. Navigate to the strategy you want to trade live.
  2. Click Live Trade (or Paper Trade for simulation).
  3. Select the broker account to use.
  4. Review and confirm your risk management settings, including the Flatten on shutdown option (see below).
  5. Click Start Session.

The session moves through Starting, then enters Running once everything is ready.

These two controls are easy to confuse because they both “stop” something. The mental model that keeps them straight: there are two separate axes.

Axis 1 — Orderly vs. immediate. Stop drains the session gracefully. Emergency Stop skips the drain and acts immediately. Both are permanent; starting fresh requires creating a new session.

Axis 2 — Keep positions vs. close positions. Stop (with Flatten off) leaves your positions open for you to manage. Stop (with Flatten on) and Emergency Stop both close everything at market.

Stratifyre no longer has a user-triggered Pause. Stepping away no longer requires an action on your part outside market hours — the session automatically goes Idle when its market closes and resumes on its own before the next open (see Idle above). If you want to stop trading a session for good, use Stop or Emergency Stop below.

Action Reversible? New orders? Working orders Open positions Broker connection Ends in state
Stop (Flatten OFF) No Halted Canceled Left open (you manage) Disconnected Stopped
Stop (Flatten ON) No Halted Canceled Closed at market Disconnected Stopped
Emergency Stop No Halted Canceled immediately Closed at market immediately Disconnected Emergency Stopped
  • Done for the day, want to keep my positions open overnight → Stop with Flatten OFF. Your broker account keeps the positions; the session ends.
  • Done for the day, want everything closed cleanly → Stop with Flatten ON. Orders are canceled and positions are closed at market before the session ends.
  • Something is wrong and I need out of the market right now → Emergency Stop. No waiting, no ceremony — everything closes as fast as possible.
  • Market is closed and I just want a break until next session → Nothing to do. The session already goes Idle automatically and resumes before the next open.

Stop ends the session in an orderly way. It cancels all working orders, optionally closes your positions (depending on your session’s Flatten on shutdown setting), then disconnects from the broker. This is a terminal action — the session ends in Stopped and cannot be resumed.

What happens to your positions depends entirely on the Flatten on shutdown setting you chose when you configured the session:

  • Flatten on shutdown ON: Stop cancels all working orders, then submits market orders to close all open positions before disconnecting.
  • Flatten on shutdown OFF: Stop cancels all working orders and disconnects, but leaves your positions open in your broker account for you to manage manually.

Emergency Stop is the panic button. It immediately cancels all orders and closes all positions at market, in parallel, without waiting for an orderly drain. It is available from Running or Idle.

Key behaviors that distinguish it from a normal Stop:

  • Always flattens. The “Flatten on shutdown” setting is ignored. Everything closes.
  • Parallel, not sequential. Order cancellations and position closes happen simultaneously, not one-after-another.
  • Tolerant of broker failures. If the broker is unresponsive, Emergency Stop keeps going rather than hanging. It operates with a bounded timeout (~30 seconds per phase) and will not wait indefinitely.
  • Distinct end state. The session ends in Emergency Stopped, not Stopped — so your session history clearly shows this was a force-kill, not a normal shutdown.
  • Can trigger automatically. You do not have to press the button. The platform’s safety systems may trigger Emergency Stop on your behalf if a drawdown or risk limit is breached, the broker connection cannot be recovered, or the data feed becomes stale beyond a configurable threshold. This is by design — the system will protect you even if you’re not watching.

If Emergency Stop itself cannot complete cleanly (for example, the broker is completely unreachable), the session ends in Error rather than Emergency Stopped, with full details in the event log.

Network interruptions and brief broker outages are a reality of electronic trading. Stratifyre’s auto-recovery system handles these disruptions automatically so your session can continue without manual intervention.

  1. Disconnection detected. If the data feed or broker connection drops, Stratifyre immediately logs the event and begins reconnection attempts.
  2. Automatic reconnection. The system retries the connection at increasing intervals (e.g., every 1 second, then 2 seconds, then 5 seconds, and so on).
  3. State reconciliation. Once reconnected, Stratifyre reconciles its internal state with the broker. It checks for any fills that occurred during the disconnection and updates positions accordingly.
  4. Session resumes. If reconciliation is successful, the session returns to the Running state and continues normally. You receive a notification that a disconnection and recovery occurred.

If the system cannot reconnect within a reasonable timeframe (configurable, typically a few minutes), the session moves to the error state. This prevents the strategy from operating on stale data or missing fills for an extended period.

Cryptocurrency strategies benefit from enhanced auto-recovery. Since crypto markets run 24/7/365, brief Binance API interruptions are expected. Stratifyre’s crypto session manager is designed to:

  • Tolerate short disconnections without halting the session.
  • Automatically reconcile missed fills from Binance.
  • Resume normal operation once connectivity is restored.
  • Alert you only if the disconnection exceeds a configurable threshold.

While a session is running, Stratifyre continuously monitors its health across several dimensions:

  • Is real-time data being received?
  • Is the data arriving within expected latency bounds?
  • Are there any gaps or stale quotes?
  • Is the broker API responding?
  • Are orders being acknowledged promptly?
  • Is the account in good standing (margin requirements met, no restrictions)?
  • Is the strategy evaluating conditions within expected time limits?
  • Are indicators calculating correctly?
  • Are there any runtime errors in strategy logic?
  • How close is the session to any risk limit (position, daily loss, drawdown)?
  • Have any limits been breached since the session started?
  • Is the order rate within configured bounds?

All of these health metrics are visible on the session dashboard and are checked continuously. If any metric falls outside acceptable bounds, you receive an alert.

Every session – whether paper or live – is recorded with a complete history:

  • Configuration snapshot – The exact strategy, risk settings, and broker connection used.
  • Trade log – Every order submitted, every fill received, with timestamps and prices.
  • Performance metrics – P&L, win rate, drawdown, and other metrics calculated over the session’s lifetime.
  • Event log – Every state transition (started, idled, resumed, stopped), disconnection, recovery, and risk limit event.

This history lets you review past sessions, compare paper vs. live performance, and diagnose any issues that occurred.

  • Configure Risk Management to ensure your sessions are protected from every angle.
  • Try Paper Trading to experience the session lifecycle without risking real capital.
  • Review Broker Setup to connect your brokerage account and prepare for live trading.