Skip to content
All library documents

Adding Trade Direction and Holding Period to MQL5 Order Indicators

Article MQL5 articles

Summary

This article improves a MetaTrader 5 Expert Advisor’s chart indicators so traders can identify whether a pending order is for a buy or sell and whether it is intended as a day trade or a longer swing trade. Bitmap icons encode direction and holding period, while new chart objects and events connect those indicators to the order system. The article also describes preserving indicator information when an order becomes a ghost or changes from pending to floating, and allowing direction changes on floating orders.

The examples focus on implementation and chart behavior rather than measuring trading performance. The indicators make order state easier to inspect, while server-side orders cannot have their direction changed through the chart control. The author advises getting familiar with the system before using it on a live account. The article presents one possible extension to a larger EA and leaves further order-system changes for later work.

Key ideas

  • Bitmap indicators can show pending-order direction and whether a trade is intended to last one day or longer.
  • New chart objects need distinct event names so the EA can process their interactions.
  • Indicator data can be preserved when an order is converted into a ghost or floating state.
  • The direction control can reverse a floating order, while orders already on the server are excluded.
  • Chart indicators can help clarify position lifetime when that information is not shown in the trading platform’s toolbox.

Tags

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