Skip to content
All library documents

Previous Candle Breakout EA with Position Caps and Risk Sizing

Article MQL5 code base

Summary

This document describes an Expert Advisor that enters when price breaks the prior candle’s high or low, using a selectable candle timeframe from one minute to one month. A moving-average filter can be enabled, and the first trailing-stop adjustment moves the stop to breakeven. Position size is either a fixed lot amount or a risk-based amount; the settings must not enable both or leave both disabled.

The EA limits the number of positions per direction and can enforce a maximum combined position volume before accepting another signal. It can also close all positions once a profit target is reached. The document explains these controls with an example of a volume cap and lists the main inputs. It provides no performance testing or evidence of profitability, and the description does not specify the moving-average rules or how the profit target is calculated.

Key ideas

  • The EA looks for breaks of the previous candle at a configurable timeframe.
  • A moving-average filter is optional, and the first trailing-stop change moves the stop to breakeven.
  • Trade size uses either fixed lots or a risk percentage, but not both or neither.
  • Position-count and total-volume limits can prevent additional entries.
  • The document describes controls but gives no strategy performance results.

Tags

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