EMA Trend Filters, Prior-Range Breakouts, and Close-Based Risk Exits
Summary
The strategy combines a trend filter with channel breakouts. It defines an uptrend when the fast EMA is above the slow EMA and the slow EMA is rising over a configurable lookback; the short condition reverses those relationships. A confirmed close above the prior-bar high channel triggers a long entry, while a close below the prior-bar low channel triggers a short entry. Excluding the current bar from channel calculations prevents it from setting its own breakout threshold.
Positions exit on a close beyond a shorter opposite channel or a trailing risk level based on ATR and the most favorable confirmed close. That risk line only tightens. The script models commission, slippage, and next-tick order fills, and supports full-history, in-sample, and out-of-sample date windows. It also warns that simulated fills can differ from live execution, especially around gaps, and that full-history results are descriptive rather than validation. The supplied material reports no performance outcome; sample splits, costs, market selection, and parameter choices remain important limits.
Key ideas
- Trend direction requires fast-versus-slow EMA alignment and a confirming slope in the slow EMA.
- Breakouts use prior-bar channel levels, leaving the current bar out of the threshold calculation.
- Exits use a shorter channel or a monotonic ATR-based close-risk level.
- Signals are evaluated on confirmed bars and orders are simulated for next-tick execution with stated costs.
- The in-sample and out-of-sample windows support comparison, but historical results alone do not validate the strategy.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.