Order Types & Fills

From signal to execution. Learn how AlgoLift models market, limit, and stop orders with institutional-grade queue logic.

Updated 2024-03-23
intermediate

Order Types & Fills

In a backtest, an "Entry Signal" is only half of the equation. The other half is the Fill Logic—the set of rules the engine uses to determine the exact price and time your order is executed. Most retail platforms assume "Instant Fills," which leads to inflated results. AlgoLift uses a sophisticated matching engine that models the structural mechanics of a live exchange.

Understanding how different order types interact with our engine is vital for realistic strategy validation.

The Fill Reality Gap

A strategy that looks profitable with "Market Orders" in a backtest may lose money in live trading due to the spread. Conversely, a strategy using "Limit Orders" may look profitable in a backtest but fail in reality because the orders were never actually filled.

Market Orders: Modeling the Spread

Market orders are instructions to "buy or sell immediately at the best available price."

  • The Ask/Bid Rule: When you buy at market, the engine fills you at the Ask. When you sell, you are filled at the Bid.
  • Slippage Modeling: If your order size exceeds the available liquidity at the top of the book, AlgoLift "walks the book," filling the remainder of your order at progressively worse prices. This is why tick-level depth (Level 2) data is essential for high-volume traders.

Limit Orders: Queue Priority

Limit orders are instructions to "buy or sell only at a specific price or better." These orders provide "Maker" liquidity and avoid the spread, but they carry Execution Risk.

  • Touch vs. Fill: Simply seeing the market "touch" your limit price is not enough for a fill in AlgoLift.
  • Queue Modeling: Our engine tracks your position in the "Queue." You are only filled once the historical volume at that price level is sufficient to clear all the orders that were theoretically resting in front of yours.
Under the Hood: The 'Simulate Fills' Toggle

You can toggle the engine's strictness.

  • OFF: Fills occur immediately when price is hit (useful for logic testing).
  • ON: The engine activates the full Queue Priority and Liquidity model. Always use "ON" for your final pre-deployment validation.

Stop Orders: The Breakout Trigger

Stop orders become Market orders once a "Stop Price" is reached. These are commonly used for breakouts or as protective Stop Losses.

  • Gapping Risk: If the market "gaps" over your stop price (common during news events or market opens), AlgoLift fills you at the first available tick, not your stop price. This accurately simulates the "slippage" that occurs during fast-moving markets.
  • Stop-Limit Orders: AlgoLift also supports Stop-Limit orders, where a limit order is only placed once the stop price is hit, protecting you from extreme slippage but increasing the risk of a "missed fill."

Complex Execution: Scale-Ins & Brackets

AlgoLift's node architecture allows for non-linear execution.

  • Scale-Ins: You can program your strategy to enter 25% of a position on a signal, and add another 25% only if the trade moves into profit.
  • Dynamic Brackets: The engine manages "OCO" (One-Cancels-Other) brackets automatically. If your Profit Target is hit, the engine instantly "cancels" the Stop Loss in the simulation, maintaining perfect accounting of your virtual margin.
Pro Tip: The Fill Audit

Use the Trade Log in the Results Explorer to audit your fills. If you see a market order filled several ticks away from the "Close" of a bar, that is the engine correctly modeling slippage. This "pain" in the backtest is what saves your capital in the live market.