Skip to content
All library documents

Linear SVM Direction Classification for Hourly Bitcoin Trading

Article Strategy library · Author: Zero

Summary

This example trains a linear support vector classifier on Bitcoin bar opens and closes. It labels each historical bar by whether the next close rises or falls beyond a configurable spread threshold, or stays within that threshold. At each new bar, the model is refit using the available observations and predicts one of those three outcomes for the current bar. The strategy opens a long or short position on an up or down prediction and closes when the prediction no longer supports the held direction.

The published backtest settings cover hourly BTC/USD data on Bitfinex over a short period in 2019. The script tracks the number of predictions and those counted as correct, but the document supplies no resulting accuracy or profit figures. It gives little detail on validation or safeguards against overfitting: training repeatedly uses the historical sample, and the inputs are limited to open and close values. Position handling also depends on account balances and exchange orders, so real-world execution and library setup may affect behavior.

Key ideas

  • The classifier predicts upward, downward, or limited movement using a spread threshold on the next bar’s close change.
  • Training features are the open and close values of historical bars.
  • The model is refit as new hourly bars arrive and its class prediction drives directional positions.
  • The example reports a prediction hit count but provides no measured accuracy or return results.
  • Its brief test period, simple features, and execution dependencies limit conclusions about general performance.

Tags

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