Skip to content
All library documents

A Short Moving Average Crossover Bot for Digital Assets

Article Strategy library · Author: 小草

Summary

This introductory digital-asset bot compares fast and slow moving averages of recent candles and uses the crossover distance as an entry signal. When the fast average has moved sufficiently above the slow average, it attempts to buy with most of the available cash; when it has moved sufficiently below, it sells the held asset. A configurable observation threshold, polling interval, and slippage input shape the behavior. The example also calculates account-value change relative to its starting value and cancels an order if it remains pending.

The material is mainly a compact coding example intended to illustrate bot construction and the distinction between backtests and live trading. Its published BTC-USDT spot test covers one day and reports no strategy returns or other evaluation metrics. It does not describe a stop loss, position-risk framework, or broader validation across market conditions. The brief test window and simple crossover logic provide no basis for inferring durable profitability, and execution details such as slippage and order handling matter in live use.

Key ideas

  • The bot uses the crossover between fast and slow moving averages to trigger buys and sells.
  • A configurable threshold determines how strong the crossover must be before acting.
  • Buy sizing uses most available cash, while sell orders attempt to liquidate the held asset.
  • The example includes slippage, polling, pending-order cancellation, and account-value tracking.
  • Its one-day BTC-USDT test has no reported performance metrics and does not establish strategy effectiveness.

Tags

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