Skip to content
All library documents

Moving Average Crossovers with Risk-Based Position Sizing

Article Strategy library · Author: ChaoZhang

Summary

This strategy uses a fast and a slow moving average to define directional trades: an upward cross opens a long, and a downward cross opens a short. The document presents dynamic position sizing based on account equity and a user-defined risk setting, alongside customizable average lengths, chart signals, and alerts. It identifies 10 and 20 periods as the defaults and describes risk percentage inputs, while proposing filters, adaptive parameters, and explicit stop and take-profit rules as possible extensions.

No performance results are provided. The text notes that moving averages can miss sharp reversals and generate misleading signals in sideways markets, and that poor parameter or risk choices can increase losses. A key implementation caveat is that the source calculates a lot size but does not use it in its entry orders; the claimed dynamic sizing therefore is not evident in the code. The source also closes and reverses on opposite crossovers without adding the stop-loss or take-profit controls discussed as future improvements, so those controls should not be treated as implemented features.

Key ideas

  • Crosses between fast and slow moving averages generate long and short signals.
  • The document describes position sizing that scales with account equity and chosen risk inputs.
  • The source calculates a lot size but does not use it in the entry orders.
  • The shown entries and exits rely on opposite crossover signals rather than explicit stop-loss or take-profit orders.
  • Sideways markets, sudden reversals, and unsuitable parameter choices are cited as risks.

Tags

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