Skip to content
All library documents

Placing a Grid of Pending Orders Above the Market

Article MQL5 code base

Summary

This script places a configurable sequence of pending orders above the current price. Inputs control the initial gap, spacing between orders, order type, number of orders, trade volume, stop loss, and take profit. The example uses buy-stop orders on AUDCAD, with progressively higher entry levels and attached stop-loss and take-profit prices. The script also checks that the requested volume is positive and valid for the symbol before submitting orders.

Trade requests are sent asynchronously, allowing the script to submit several orders quickly. The included log reports five requests issued within roughly one millisecond and confirmations arriving over roughly 80 milliseconds. These timings are a single example from the document, not a general execution guarantee. The material explains order placement mechanics, not a market strategy: it does not state when the grid should be deployed, how to handle correlated fills or total exposure, or whether the setup is profitable. Order type and risk settings must be configured to fit the instrument and trading plan.

Key ideas

  • The script distributes pending orders above the current price using a configurable gap and step.\nUsers specify order type, count, volume, stop loss, and take profit.\nAsynchronous trading mode allows order requests to be sent rapidly.\nAn example log shows five orders submitted and then confirmed, but this is not a general speed guarantee.\nThe document describes execution mechanics without evaluating the grid's profitability or aggregate risk.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.