Skip to content
All library documents

A Bar-Open Comparison Strategy with Stop-Loss or Bar-Based Exit

Article MQL5 code base

Summary

The document describes a simple Expert Advisor that compares the opening price of the current bar with the opening price of the third bar. It opens a buy when the current bar’s opening price is higher; otherwise it opens a sell. Positions are closed by a stop loss or at the start of the next bar, making the intended holding period short and tied to bar boundaries.

The note also discusses operational safeguards for a system that acts when a new bar appears. It recommends resetting the timer if current prices cannot be updated and checking both the trade call’s success and that a deal was actually recorded. No market, bar interval, stop-loss size, backtest, or performance evidence is supplied, so the rule is a strategy sketch rather than evidence of profitability.

Key ideas

  • The strategy compares the current bar’s opening price with that of the third bar.
  • It buys when the current opening price is higher and sells otherwise.
  • A position exits at its stop loss or when the next bar begins.
  • The Expert Advisor checks price updates and confirms that trade operations produce a deal.
  • The document provides no backtest or performance evidence.

Tags

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