Skip to content

Maximum profit

The Maximum profit module prevents opening new orders once the profit within a period (for example a day) reaches a target. The profit includes the profit or loss of the orders that are still open. Use it to stop for the day when your target is reached.

00:00 16:00 00:00 Result today ($) No new orders $0 +$16 Maximum profit 1 TP hit: +$8 2 Maximum profit reached No new orders 3 New D1 period back to $0
Maximum profit
  1. The module adds up the profit of the current period: closed orders plus the open orders.
  2. When it reaches Maximum profit, no new orders open for the rest of the period. Open orders keep running.
  3. When a new period starts, the count starts at 0 again and the EA can open orders again.
  • Name: optional, tells this module apart from others of the same kind. See Name.
  • Maximum profit: the profit at which new orders are blocked.
  • Unit: Pips, Money or Percentage of balance. See Unit.
  • Per (timeframe): the period in which the profit adds up: Current timeframe (the chart’s), M1, M5, M15, M30, H1, H4, Daily, Weekly or Monthly. With Daily, all profits of the current day add up to your total profit.

The window starts at the beginning of the selected period and resets when a new period begins:

  • Daily resets at the start of each day (midnight, broker server time).
  • Weekly resets at the start of each week.
  • Monthly resets at the start of each month.

When the window resets, the profit is cleared and the EA can open new orders again, as long as your other strategy modules also allow it.

Your Maximum profit is $16 per Daily. Your EA closes its second winning trade at 16:00, and the day’s total profit passes $16. New orders are blocked for the rest of that day.

The block is not lifted 24 hours later (16:00 the next day), but at the reset of the day window at midnight (00:00): the next day starts a fresh $0 count.

We could have built a module that closes all orders when the maximum profit is reached, but we chose to only prevent opening new orders. An order should be allowed to run its normal course instead of being cut off prematurely. A maximum profit shouldn’t be an afterthought, but a well thought out part of your EA.

So if you want at most 5% of profit a day, make sure the maximum profit of this module plus the take profit of your Take profit module never pass 5%. With a take profit of 1% of the balance, you would be wise to set this module to 3.5%.

MetaTrader is a registered trademark of MetaQuotes Ltd. EA Builder Pro is not affiliated with MetaQuotes.