Skip to content
All library documents

EMA Alignment and Prior-Bar Breakouts with Risk-Reward Exits

Article Strategy library · Author: ankurb171991

Summary

This strategy combines four exponential moving averages with a one-bar price breakout. A long signal requires the close to be above the 20-, 50-, 100-, and 200-period EMAs and above the prior bar's high. A short signal requires the close to be below all four averages and below the prior bar's low. It can limit each signal type to one trade per day and prevents a new position when either direction is already open.

For entries, the previous bar's low or high defines the initial stop reference, and the profit target is set using a configurable risk-reward multiple. Optional trailing-stop settings are available; the displayed long-side exit logic also refers to closes below the shorter EMAs. The code excerpt ends partway through the exit rules, so the complete short-side behavior cannot be assessed. It includes inputs for dynamic support and resistance display, but the shown entry conditions do not use those levels. No backtest results or asset and timeframe context are supplied, so the rules are not accompanied by evidence of performance.

Key ideas

  • Long entries require a close above all four EMAs and the prior bar's high.
  • Short entries require a close below all four EMAs and the prior bar's low.
  • The previous bar's opposite extreme sets the initial stop reference, with a configurable risk-reward target.
  • Daily trade limits and optional trailing stops are provided as settings.
  • The excerpt is incomplete and reports no backtest performance.

Tags

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