Skip to content
All library documents

Single-Bar OHLC Direction Signals with Spread and Risk Controls

Article MQL5 code base

Summary

This expert advisor generates a directional signal from a selected bar’s open and close: a close above the open indicates a buy, while a close below the open indicates a sell. It evaluates signals only when a new bar appears. A reverse mode can invert the direction, and signals are ignored when the current spread exceeds a configured maximum.

The description also explains optional stop-loss and take-profit settings, a selectable working timeframe, and two mutually exclusive volume approaches: a fixed lot size or a risk percentage per trade. It mentions a EURUSD real-tick testing setup, but gives no performance results, sample period, or comparison with a benchmark. The rule is a simple candle-direction heuristic; the text does not establish that it predicts future price movement or specify detailed execution, risk-sizing, or backtest assumptions.

Key ideas

  • The advisor checks its trading condition when a new bar forms.
  • A bullish bar close relative to its open triggers a buy signal, while a bearish close triggers a sell signal.
  • A reverse setting can switch the direction of generated signals.
  • The advisor can ignore signals above a configured spread limit and can use optional stop-loss and take-profit levels.
  • Trade volume can be fixed or based on a risk percentage, with the settings intended to be used separately.

Tags

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