Random Forest Trend Classification from Recent Bitcoin Returns
Summary
This script trains a random forest classifier to label short-term Bitcoin price changes as rising, falling, or relatively flat. It samples the latest price hourly, calculates consecutive percentage changes over a rolling window, and assigns directional labels using thresholds of plus or minus 0.5 percent. Recent sequences become features, with the next label as the target; fitting begins after 200 training examples have accumulated.
The trading logic buys with the available account balance when the model predicts an upward move and sells the accumulated asset amount when it predicts a downward move. The published backtest settings specify BTC/USD on Bitfinex over roughly one month, with hourly strategy sampling and fifteen-minute base data, but include no performance results. The brief window and continually updated training data limit what can be inferred about generalization. The source also provides no transaction-cost model, risk controls, or safeguards against overfitting, so its predictions do not establish a reliable trading edge.
Key ideas
- The classifier uses recent sequences of percentage price changes as features.
- Returns above or below 0.5 percent are labeled as directional moves, with smaller changes treated as flat.
- Model fitting starts after 200 labeled examples have accumulated.
- The strategy buys on an upward prediction and sells on a downward prediction.
- The published backtest settings provide no results or transaction-cost analysis.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.