Telemetry off
Documentation

Documentation

3. Positions, Brackets & Fills

Created
Aug 28, 2026
Updated
Aug 29, 2026

This page explains what the engine does with your orders: how fills are simulated, how a position is built and unwound, and how take-profit and stop-loss brackets behave. The rules follow TradingView's Paper Trading so that what you practise here transfers.

Fills are simulated. They assume unlimited liquidity at the quoted price, never partially fill, and are only as good as the feed driving them. See the Overview for the full disclaimer.

Where prices come from

The engine is fed by the chart itself, one update per symbol per animation frame:

  • Tick feed — when the pane has a live price, each update is a sample carrying the last price, and resting orders are evaluated against it.
  • Quote snapshot — when you place an order, the bid and ask shown in the panel or ticket (Binance, OKX, and Kraken expose them in the ticker overview) are attached to the order and evaluated immediately, so a market order or a marketable limit fills against the quote you saw rather than waiting for the next tick. The overview is refreshed every 30 seconds while a trading surface is open, and its bid / ask are trusted for fills only while they are less than 15 seconds old and within 2 % of the last price — otherwise the fill uses the last price, never a stale book.
  • Bar fallback — when no tick has arrived (Massive and Alpaca bars, OKX's bar stream, or a stale feed), the in-progress bar is used and walked along its intrabar path (below) — but only the segment since the previous update. A bar is never re-walked: the first update after opening a chart, a switch to another timeframe, or the moment a quiet trade feed hands over to bars feeds just the current price, so a level the bar touched before your order existed cannot fill it.
  • Replay — during bar replay, the replayed bars are the feed and live prices are suspended for that symbol.

Only symbols open on a pane produce samples. Orders on any other symbol wait, and its position keeps its last mark, until you open that chart again.

Fill rules

OrderTriggers whenFill price
Market buy / sellImmediately against the quote attached at placement, else on the next price updateAsk (buy) or bid (sell) when known, else last — plus the configured slippage ticks against you
Limit buyLast (or the ask quoted at placement) ≤ limit priceThe limit price
Limit sellLast (or the bid quoted at placement) ≥ limit priceThe limit price
Marketable limit (buy above the ask / sell below the bid)Immediately, with a warning in the ticketThe limit price; with Fill limit at gap price on, the better market price instead
Stop buyLast ≥ stop priceFills as a market order: ask/last plus slippage; a gap through the stop fills at the gap price
Stop sellLast ≤ stop priceFills as a market order: bid/last minus slippage
Stop-limitThe stop triggers on last, then the order works as a limit (checked again on the same update)The limit price
Take-profit bracketLike a limit on the opposite side, once the parent has filledIts limit price
Stop-loss bracketLike a stop on the opposite side, once the parent has filledMarket ± slippage

Fill prices are rounded to the instrument's tick, and every execution is booked with its commission (see Settings).

Bars are walked, not sampled at the close

When a sample carries a bar instead of a tick — no tick feed, a stale feed, or replay — the engine does not simply test the close. It walks the bar's path open → nearer extreme → farther extreme → close (the extreme closer to the open comes first) and evaluates every working order at each step. A limit or stop whose level lies inside the bar's range therefore fills at its own price, and a stop-limit that triggers and becomes marketable within the same bar can fill in that bar. If the open gaps past a stop, the stop fills at the open (the gap price); a gapped limit fills at its limit price unless Fill limit at gap price is on.

Session and duration gates

  • With Regular session only enabled, equities are not filled outside 09:30–16:00 US Eastern — not from price updates, and not by the immediate fill that normally follows placing, modifying, or closing. Working orders — market orders included — simply wait for the first in-session update; positions keep marking to market. Bar updates count as in-session when the bar overlaps the session.
  • DAY orders are canceled when the first update of the instrument's next trading day arrives — the US Eastern calendar day for stocks and futures, the UTC day for crypto and forex; GTT orders when their time passes; IOC / FOK orders on the first update that does not fill them. A DAY order's day, and a stop-limit's triggered state, are stored with the order, so a page reload changes neither.

Positions

Positions are netted: one position per symbol, long or short.

  • Adding in the same direction raises the quantity and recomputes the average price.
  • Reducing matches the oldest lots first (FIFO). Each closed lot becomes a row in the closed-trade ledger with its own entry price, exit price, and P&L, and the realized P&L — net of commission — is booked to your balance. The position that remains is re-averaged over the lots still open (bought 1 @ 100 and 1 @ 110, sold 1 @ 120: +20 is realized on the 100 lot and the remaining unit is carried at 110), so a partial close at the market never moves your equity.
  • Crossing through zero closes the position and opens a new one in the other direction at the fill price.
  • Unrealized P&L is recomputed on every price update from the last price: (last − average) × qty, sign-adjusted for shorts. Equity is always balance plus unrealized P&L.

Position line and actions

An open position draws a solid line at its average price with a right-side label — Long or Short, the quantity, and the live P&L in cash and percent, coloured by sign. The label carries buttons:

  • closes the position at market.
  • reverses it: a market order for twice the quantity, which drops any existing brackets — protect the new position afterwards if you want them back.
  • TP / SL appear when the position has no bracket of that kind; they open the position dialog to add one.

Double-click the label to open the position dialog (Protect position), where you can set or edit brackets, close part of the position, or reverse it. The same actions are available on the row in the Account Manager's Positions tab and — for close — in the chart's right-click Trade group.

Closing a position (fully) cancels its brackets. A partial close keeps the brackets and resizes them to the remaining quantity.

Closing and reversing are reduce-only

Close and Reverse send a market order that is tied to the position it came from. It can only reduce that position: if the position is already gone (for example because a stop-loss filled first), the closing order is voided instead of opening a trade in the opposite direction, and a larger close is capped to what is left. While a closing order is still working — no price has arrived yet — a second Close or Reverse on the same position is refused rather than queued, so pressing a button twice can never flip you. Closing orders take the chart's current price, so they fill immediately whenever a price is showing on the chart.

Brackets: take profit and stop loss

Brackets are real child orders, not fields on the position:

  1. When you place an order with a take profit and/or stop loss, the engine creates the parent plus a TP child (a limit on the opposite side) and/or an SL child (a stop on the opposite side). The children are inactive — drawn as dotted lines — until the parent fills.
  2. When the parent fills, the children become working orders attached to the position, sized to the position quantity, and their lines turn dashed.
  3. They are OCO — one cancels the other. When the take profit fills, the stop loss is canceled, and vice versa. The take profit fills at its limit price; the stop loss triggers on the last price and fills as a market order with slippage.
  4. If a bar's path touches both levels, the order in which the path reaches them decides which fills; the other is canceled.
  5. Brackets activated by a fill are checked against the rest of that bar's path only — the part after the entry price. A take profit or stop loss that the bar touched before the entry cannot fill on the entry bar.
  6. Bracket children are reduce-only and always sized to the position: their quantity cannot be edited (the ticket disables it), so a stop can never flip you into the opposite direction.

You can add brackets to an existing position (the TP / SL buttons, the position dialog, or the Protect row action), edit them in the ticket's Modify mode for a working parent, or drag a bracket line to a new price — the engine snaps it to the tick grid and updates the order. Dragging a bracket that belongs to a still-working parent updates the parent's TP/SL so both stay in sync.

Unit choices in the ticket (Price, Ticks, %, $) are conversions of the same absolute price: ticks and percent are measured from the entry (limit or stop price, else the ask/bid), and $ is the cash P&L at that level for the order quantity. The ticket shows the resulting price and the potential profit or loss, and the risk:reward ratio when both are set.

Order lines and fill markers

Working orders draw dashed lines at their limit or stop price, labelled with the side and type (Buy Limit, Sell Stop, Stop-limit) and the quantity, in the buy or sell colour of your theme. Drag a line to move the order; for a stop-limit both legs move together, keeping their offset. A press that does not travel is a click, not a move, and a drag that lands on the same tick changes nothing — neither sends a modification. The button (or a double-click) opens the ticket in Modify mode and cancels.

Every execution places a marker on the chart: an up arrow below the bar for buys, a down arrow above the bar for sells, each labelled with the quantity. Markers for fills that reduce, close, or reverse a position are coloured by their realized P&L and show the amount (a break-even close shows +$0.00). A marker sits on the bar in which the fill happened on that pane's timeframe; in replay, fills beyond the cursor are not drawn until their bar is revealed.

Next steps

Track everything the engine did in the Account Manager.

Next: Account Manager