Skip to content
All library documents

EMA Golden and Dead Cross Strategy for Long and Short Trades

Article Strategy library · Author: holybit

Summary

This script uses a fast and a slow exponential moving average to define trend changes. A cross of the fast average above the slow one signals a bullish regime; a cross below signals a bearish regime. Users can choose long-only, short-only, or both directions. In the two-direction setting, each signal closes the opposing position and opens a new one. The display adds cross markers, a background trend color, and a table of current average values. The default lengths are 50 and 200, and the strategy sizes orders as a percentage of equity.

The document provides code and a brief claim that the method may suit ETF trading, but it includes no backtest settings, performance metrics, or supporting evidence for that claim. Moving-average crossovers are lagging signals and can produce repeated reversals in sideways markets. The script specifies no explicit stop loss, take profit, transaction costs, or other risk controls, so those effects are not assessed in the material.

Key ideas

  • The strategy treats crosses between fast and slow EMAs as bullish or bearish signals.
  • A direction setting lets the user trade long, short, or both ways.
  • In two-direction mode, a new cross closes the opposing position and opens a position in the new direction.
  • The material provides no performance evidence or explicit stop-loss and take-profit rules.

Tags

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