Skip to content
All library documents

20/200 SMA Strategy with Configurable Entries and Stops

Article Strategy library · Author: gpmpastorsc

Summary

This Pine strategy excerpt defines a moving average framework using configurable fast and slow simple moving averages, set by default to 20 and 200 periods. It offers buy-only, sell-only, or two-way trading and three entry strictness choices: entering at a crossover, waiting for a trend pullback, or using a relaxed test mode. A bar limit controls how long after a crossover entries may be considered.

Risk controls include a take-profit distance and selectable stop methods based on an opposing candle beyond the slow average, a fixed distance, or a recent swing. Optional filters can check the slow average’s slope, candle color, and distance from the fast average. The excerpt ends during the SMA calculations, before the entry, exit, sizing, or order logic is shown. It provides no backtest results or evidence of performance, so the full behavior and suitability cannot be assessed from this text alone.

Key ideas

  • The strategy compares configurable fast and slow simple moving averages to define its trading framework.
  • It supports long, short, or two-way trading and offers several entry strictness modes.
  • Stops can use an opposing candle, a fixed distance, or a recent swing.
  • Optional filters check trend slope, candle direction, and distance from the fast average.
  • The supplied excerpt omits the actual entry and exit logic and reports no performance results.

Tags

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