Trigger-Based Planned Buy Orders with Market or Limit Execution
Summary
This order utility monitors price until it crosses a chosen trigger level, then places a buy order. It supports either a market-style purchase sized by a spending amount or a limit order with a specified price and quantity. The example checks whether price crosses the trigger from either direction, so the planned purchase can follow an upward or downward crossing. It also checks available account balance and polls market data and order status.
For the market option, the procedure repeatedly submits orders near the ask while adjusting the remaining amount based on observed balance changes and available ask size; the limit option retries order placement a limited number of times. The document supplies implementation details and configurable polling and minimum-size parameters, but no execution-quality measurements. Its behavior depends on the exchange interface and live order-book conditions, and repeated polling or order handling may not guarantee a precise fill or final spend.
Key ideas
- A trigger crossing starts a planned buy using either a spending amount or a limit price and quantity.
- The example recognizes crossings both above and below the configured trigger.
- The market-style path works through repeated orders near the ask and adjusts for the remaining spend.
- The limit-order path retries placement and reports whether an order was accepted.
- Execution depends on account data, exchange behavior, available liquidity, and changing prices.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.