Skip to content
All library documents

Detecting Order and Position Modifications in an MQL5 Event Library

Article MQL5 articles

Summary

This installment explains how to extend an MQL5 trading-event library to detect modifications to existing orders and positions. It adds modification flags to event identifiers, includes order direction among searchable and sortable properties, and derives a modification event class from the library's abstract event class. The article distinguishes changes to pending orders from changes to positions and describes tracking fields such as stop loss, take profit, price, and direction.

A test expert advisor lets users change stop loss and take profit through buttons and apply trailing levels, with journal entries used to observe the resulting events. The article describes checks on both netting and hedging accounts, but the supplied excerpt does not show detailed outcomes or performance evidence. This is infrastructure for event detection and trading-program development rather than a standalone trading strategy; the next planned work concerns broader library compatibility.

Key ideas

  • The library represents order and position modifications as distinct trading events.
  • Event flags identify order changes separately from position changes.
  • Adding direction as a sortable property supports searches for pending orders by direction.
  • A test advisor checks button-driven stop and take profit changes and trailing behavior.
  • The article supplies no quantitative evidence about a trading strategy's returns.

Tags

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