Skip to content
All library documents

Nextbar Expert Advisor with Bar-Close Signals and Position Limits

Article MQL5 code base

Summary

This Expert Advisor checks for new entries and exit conditions when a new bar appears, while its trailing-stop logic checks on every tick. It compares the close of bar one with the close of a user-selected signal bar, requiring that the signal-bar index be at least two and that the price difference exceed a minimum distance. A new signal is allowed only when there are no open positions, and an option can reverse the generated signals.

Position size is set by a fixed Lots parameter. Stop loss, take profit, and trailing stop can each be disabled by setting their input to zero; a position can also be closed after a specified number of bars. The text describes the mechanics and mentions an EURUSD hourly illustration, but supplies no detailed results or performance statistics. It does not explain parameter selection, market-specific validation, or risk sizing beyond fixed lots, so the rules alone do not establish profitability.

Key ideas

  • The EA evaluates entry and standard exit conditions only when a new bar forms.
  • It compares a recent bar close with a selected older signal-bar close and applies a minimum distance threshold.
  • New entries are restricted to periods with no open positions, and signals can be reversed.
  • Trailing stops are checked tick by tick, while position lifetime is checked at each new bar.
  • Trade volume is fixed by the Lots setting, and the description offers no performance evidence.

Tags

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