Skip to content
All library documents

Trend Entries and Exits Using 9-Period EMA and 20-Period SMA

Article Strategy library · Author: ChaoZhang

Summary

This document explains a moving-average trend strategy using a 9-period exponential moving average and a 20-period simple moving average. It enters long when the close is above both averages and short when the close is below both, then closes positions when price crosses a moving average. The averages are plotted and candle colors indicate whether the stated long or short condition is active. The document emphasizes that the EMA responds more quickly to recent prices, while the SMA smooths a longer window.

The text gives a one-hour BTC/USDT futures backtest configuration with a 15-minute base period, but provides no performance figures. The implementation is not a conventional average-to-average crossover: entries follow price being on the same side of both averages, and the close condition detects upward crossings of either average only, which may not match the described exit behavior for all positions. The document identifies whipsaws in ranging markets, lag during sharp moves, and sensitivity to chosen periods, and suggests testing filters and explicit risk controls.

Key ideas

  • Long and short entries depend on the close being above or below both moving averages.
  • The 9-period EMA weights recent prices more heavily, while the 20-period SMA averages a longer set of closes.
  • The source code's exit condition detects upward price crossings and may not implement the prose's general recross exit.
  • Moving-average signals can whipsaw in range-bound markets and lag during fast reversals.
  • The backtest configuration specifies BTC/USDT futures but includes no reported results.

Tags

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