Skip to content
All library documents

Trading EMA Golden and Dead Crosses with Direction Controls

Article TradingView scripts

Summary

This crossover strategy compares a fast exponential moving average with a slower one. A fast average crossing above the slow average generates a bullish signal; crossing below generates a bearish signal. The defaults are 50 and 200 periods, and the strategy lets users choose long-only, short-only, or both directions. When both directions are enabled, each new crossover closes the opposing position and opens one in the new direction.

The script also plots the averages, marks crossover bars, shades the background according to which average is higher, and displays their values and the current directional state. These visuals summarize the same trend rule rather than add separate filters. The document provides no backtest results, stop or target rules, or evidence of performance across assets and timeframes. As a lagging indicator approach, signals may arrive after a move is underway, and the script’s sizing default is 100% of equity.

Key ideas

  • A fast EMA crossing above or below a slow EMA defines the directional signal.
  • The default EMA lengths are 50 and 200 periods.
  • Users can restrict trading to longs, shorts, or allow both directions.
  • In two-sided mode, crossover signals close the opposing position and open a new one.
  • The source reports no performance data or explicit stop and target method.

Tags

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