Skip to content
All library documents

Moving Average Entries with a Percentage-Based Trailing Stop

Article Strategy library · Author: Zero

Summary

This educational example pairs a fast and slow moving-average crossover with a percentage-based stop that trails as price moves in the position’s favor. After a crossover persists for the configured observation period, it opens a long or short position using a configurable share of the account’s coin balance. It initially places a stop relative to the entry price and advances a profit threshold in fixed increments; each threshold crossing moves the stop to help retain gains. The example also polls the market on a configurable interval and reports account and position status.

The material is mainly an implementation of entry, sizing, and exit mechanics rather than a tested trading thesis. It gives configurable defaults but no market, backtest results, or evidence that the crossover or trailing method is profitable. The stop is checked against the latest ticker price, so gaps, execution slippage, fees, and order handling may affect realized exits. The source itself cautions that the example is for learning and should be used carefully in live trading.

Key ideas

  • A fast and slow moving-average crossover initiates long or short positions after a configured observation period.
  • Position size is based on a configurable fraction of the account’s coin balance.
  • The strategy sets an initial stop and steps it forward as price passes successive favorable thresholds.
  • The example supplies implementation defaults but reports no backtest evidence or profitability results.
  • Ticker-based stop checks may not match actual execution prices during fast markets.

Tags

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