Skip to content
All library documents

Moving Average Price Cross Strategy with Session and Risk Controls

Article Strategy library · Author: ChaoZhang

Summary

This document describes a simple moving-average strategy that compares a selected price series with an SMA. A move above the average signals a long position, while a move below signals a short position. Trading is limited to a configurable session, and optional fixed take-profit and stop-loss levels can close positions. The source also supports alerts, bar coloring, and reversing signals. Despite the title and overview describing a pair of moving averages, the supplied code calculates one SMA and compares price against it.

The material explains the rationale for smoothing short-term noise and lists common limitations: lag, false changes of direction, parameter sensitivity, and the possibility that session limits exclude useful trades. It suggests testing different lengths, adding other indicators, or using ATR-based exits. Published backtest settings identify a short BTC-USDT futures sample, but no results are provided, so the document offers a rule description rather than evidence of profitability. The code’s fixed session close and optional exits also need to be considered when interpreting the intended risk controls.

Key ideas

  • The supplied implementation enters long or short according to price’s position relative to one SMA.
  • A configurable time window gates entries and closes positions outside the session.
  • Optional fixed profit and loss thresholds provide basic exit controls.
  • Moving-average lag and repeated direction changes can increase missed trades and transaction costs.
  • The document gives a brief backtest setup but no measured results.

Tags

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