Skip to content
All library documents

Closing Orders After a Fixed Holding Interval

Article MQL5 code base

Summary

This brief example describes an expert advisor that opens an order, modifies it to set stop-loss and take-profit levels, and closes the position after a fixed holding interval. The stated example uses a 30-second delay between opening and closing. It illustrates the mechanics of time-based position exits alongside protective price levels.

The document suggests this approach for strategies where trade duration is predetermined. It does not explain how entry signals are generated, how the stop-loss or take-profit values are chosen, or how the timed exit interacts with them. No market, backtest, or profitability evidence is given, so the example is an order-management demonstration rather than a complete trading strategy. The fixed interval may need to be adapted to instrument liquidity, volatility, and execution conditions before practical use.

Key ideas

  • The example opens an order, sets stop-loss and take-profit levels, then closes it after a preset delay.
  • The illustrated holding interval is 30 seconds.
  • A fixed-duration exit can support strategies whose trade lifetime is predetermined.
  • The document gives no entry logic, parameter rationale, or performance evidence.

Tags

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