EMA Crossover Strategy with Fixed-Dollar Exits and Trailing Stops
Summary
This script defines a directional strategy using crossovers between fast and slow exponential moving averages. An upward crossover opens a long position and closes a short; a downward crossover opens a short and closes a long. It includes filters that can restrict trading to a 30-minute chart and weekdays. Position sizing is set as a percentage of equity, with margin and commission assumptions specified in the strategy settings.
Exits combine a partial take profit with a separate exit order containing a further profit target, fixed stop, and trailing stop. Dollar distances are converted to ticks using the instrument’s minimum tick size. The document presents source code and parameter defaults, but no market, backtest period, or performance results, so it does not establish profitability. The excerpt ends during the short-side exit code, and its fixed dollar distances may behave differently across instruments and price scales. Fees, slippage, and the effects of the stated leverage assumptions also deserve review before drawing conclusions.
Key ideas
- The strategy enters on fast and slow EMA crossovers and reverses positions on the opposite crossover.
- Optional filters limit trading to a 30-minute chart and weekdays.
- The script sizes positions as a percentage of equity and specifies margin and commission assumptions.
- Exit rules combine a partial target with a stop, another target, and a trailing stop.
- The available excerpt provides no performance evidence and ends before the short exit logic is complete.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.