Building an MQL5 Order Assistant with Tick Adjustment and OCO Risk Levels
Summary
This article describes an object-oriented MQL5 Expert Advisor designed to help traders place pending orders from chart-selected prices. Its examples cover adjusting prices to an instrument’s tick size, calculating contract volume and monetary take-profit and stop-loss distances, and choosing limit or stop order types based on the current price and trade direction. The design uses server-managed orders with attached profit and loss levels, and can optionally set orders to expire at the end of the trading day. The discussion also addresses charting positions when an order is sent for a different symbol.
The intended use is order entry and management rather than generating trade signals: the EA helps configure an order, after which the platform handles execution and attached levels. The author cautions that partial closes and changing market conditions can create execution complications, and that position volume must be managed carefully. The examples target Brazilian futures contracts but are described as adaptable with symbol-specific adjustments. The article presents an implementation pattern, not evidence of trading performance or a guarantee of execution outcomes.
Key ideas
- Instrument-specific tick sizes must be reflected in order prices to avoid invalid price levels.
- Pending order type depends on the current market price, intended direction, and entry price.
- Attaching take-profit and stop-loss levels lets the trade server manage those exit conditions.
- Cross-symbol order entry may require extra chart logic to display positions and pending orders.
- Partial position reductions require careful volume checks and can behave unpredictably in volatile conditions.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.