Back to knowledge
Trading foundations7 min read

Foundations

How markets and orders actually work

Understand bids, asks, market orders, pending orders, and why an algorithm's decision is only the start of a trade.

Price is a two-sided quote

A market quote normally contains a bid and an ask. The bid is the price available to sell into, while the ask is the price available to buy at. The difference between them is the spread, and it is one of the first costs a strategy must overcome.

An EA that reads one price but sends an order against the other can appear to have mysterious entry or exit differences. Always know which side of the quote the rule and the order use.

Orders express an intention, not a guarantee

A market order asks for execution now at the best available price. A limit order asks for a price no worse than a specified level, while a stop order becomes active after price reaches a trigger. The broker, venue, liquidity, and account rules determine how that request is handled.

  • Market orders prioritise participation and accept uncertain price.
  • Limit orders prioritise price and accept uncertain participation.
  • Stop orders are often used to trigger entries or protect exits.
  • A rejected or partially filled order is an operational event that needs logging.

Model the whole position lifecycle

A robust algorithm treats an order as a state transition: requested, accepted, filled, modified, partially filled, rejected, cancelled, or closed. It should not assume that sending a request means the position already exists.

Understanding this lifecycle makes debugging easier and helps a backtest reflect what the live platform can actually do.

A signal is an idea. An order is a request. A position is a result that must be confirmed.

Discuss this article

Ask a setup question, share a backtest, or compare notes with other algorithmic traders. Use a display name; your email remains private.

Create an account or sign in above to join the conversation.

Loading discussion…