Skip to content
All library documents

Balancing Open Trades with Pending Hedge Orders

Article MQL5 code base

Summary

This brief trading script description explains a way to use pending orders to balance open buy and sell positions for the chart’s symbol. It compares the two sides and, when their exposure is not already fully balanced, calculates the difference and places a pending hedge intended to bring the strategy to full balance. Existing hedge orders for that symbol are removed before replacement.

The author frames the method as a manually controlled trailing hedge, with the pending-order distance specified in pips. The description does not state how hedge size is calculated, define the distance or trigger mechanics, or provide examples, performance data, or risk analysis. A balanced position can still incur costs and adverse price movements, and pending orders may not execute as intended. The material is therefore a high-level description of trade management logic rather than a fully specified or evaluated strategy.

Key ideas

  • The method compares open buy and sell trades for the chart symbol.
  • If exposure is not fully balanced, it uses the difference to set a pending hedge.
  • It deletes and replaces existing hedge orders for the symbol.
  • The pending hedge distance is specified in pips and may be used for manual trailing.
  • The short description omits sizing, execution details, and performance evidence.

Tags

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