Skip to content
All library documents

Adding Profit-Target and Daily-Loss Checks to a Breakout Expert Advisor

Article MQL5 code base

Summary

This document describes helper functions intended to support a breakout strategy during a prop firm challenge. One check compares account equity with a configured profit target. Another estimates the day’s closed-trade profit and loss from account history, derives a starting balance, and compares current equity with that balance less a daily loss limit. When a limit condition is met, a clearing function can close open positions and delete pending orders.

The examples are MQL5 code and configurable inputs, rather than a tested trading study. The author identifies profit target and daily loss as challenge constraints, but explicitly leaves maximum-loss handling to the user’s strategy and risk management. The document gives no backtest or challenge results. Its daily-loss check depends on how deal history and dates are processed, and account equity includes unrealized gains or losses, so implementation details and the relevant firm’s rules matter before use. These helpers do not define the breakout entry or a complete risk system.

Key ideas

  • The profit-target helper checks whether account equity exceeds a configured threshold.
  • The daily-loss helper estimates closed profit and loss for the current calendar day, then compares equity with an adjusted balance limit.
  • A clearing routine can close positions and remove pending orders when invoked.
  • The example leaves maximum-loss controls and the breakout strategy’s risk management unspecified.
  • No performance or prop firm challenge results are provided.

Tags

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