Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Expert Advisor | Constituents EA

The author of the idea: Scriptor

MQL5 code author: barabashkakvn

The EA waits for a control bar having its open hour equal to Start hour. After that, the search for maximum and minimum prices from the current bar up to the Search depth bar is performed. Depending on Order Type, the EA places either pending Limit orders or pending Stop ones.

You can use trading sessions to select control bar time:

MetaTrader Experts, Indicators, Scripts and Libraries

Pending orders can be removed in two cases:

  1. The lifetime has come to an end (ORDER_TIME_DAY is used - the order will be valid only during the current trading day)
  2. Any pending order has been activated - remaining pending orders are removed (the activation event is detected in OnTradeTransaction)
22595