Single Moving Average Trend Strategy with Directional Entries
Summary
This document describes a trend-following strategy that compares the latest value of a 120-period moving average with its prior value. When the ratio rises above a small threshold, the system buys if its stock balance is at or below the exchange minimum. When the ratio falls below a corresponding threshold, it sells its holdings. The code polls on a set interval, cancels pending orders before checking signals, and sizes purchases from the available account balance, subject to a minimum balance and order size.
The source provides implementation details but no backtest results or evidence of profitability. Although its comments describe Bitcoin as long-only, the shown logic can sell holdings when the average declines; it does not open a short position. The moving-average direction is used as a simple trend proxy, with no separate stop-loss or position-risk sizing rule evident in the code. Execution depends on exchange order behavior, price offsets, and the chosen polling and averaging settings.
Key ideas
- The strategy uses the direction of a 120-period moving average to signal entries and exits.
- It buys when the average rises and the account holds no more than the minimum stock amount.
- It sells existing holdings when the average falls below a threshold.
- The implementation cancels pending orders before evaluating a new signal.
- The document provides code but no performance results or backtest evidence.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.