Time-Based Trading: An EA That Opens and Closes Trades at Set Times

Some strategies do not rely on an indicator but on time itself: opening a trade at a certain hour and closing it after a period or at another hour. This kind of EA is fairly easy to describe, but it needs attention to timing details.

MetaTraderOS — Request your project now

Examples of time rules

  • Open a trade at the start of a certain session and close it before the session ends.
  • Trade only on specific days of the week.
  • Close all trades at a set hour daily or before the weekend.
  • Close a trade after a set duration (for example 4 hours) regardless of price.

MetaTraderOS — Request your project now

Important timing details

  • Server time: the EA runs on the broker time, so your required time must be converted to it.
  • Daylight saving: server time may shift and move the sessions with it.
  • Market holidays: days when prices may be unavailable or hours change.

MetaTraderOS — Request your project now

What to define before ordering

  • Entry time and exit time, and in which time zone.
  • Allowed days.
  • Direction: buy, sell or conditional.
  • Stop loss, take profit and lot size.
  • What happens if the EA cannot close at the set time.

MetaTraderOS — Request your project now

Conclusion

Time-based trading looks simple, but testing it over long periods is essential, because results change with market conditions and spread.

Want an EA that trades at set times?

At MetaTraderOS we program EAs that trade by hour, day and trade duration, with server time handled correctly.. Request your project now.

Disclaimer: this content is for technical education only and is not investment advice. Trading financial markets involves risk and may result in loss of capital.

Comments

Popular posts from this blog

Implementing Your Own Programming Ideas in MetaTrader: From Idea to Code

Programming Algorithmic Trading Systems on MetaTrader

A Control Dashboard for Your EA or Indicator: Buttons and Settings Right on the Chart