XGBoost Classifier for Long Entries with SMA and Trailing Exits
Summary
This strategy trains an XGBoost model on six price and volume features: normalized RSI, distance from a 50-period EMA, rate of change, ATR relative to price, relative volume, and the close's location within a recent price range. It periodically fits the model on 50 historical samples labeled according to whether a later close was higher. A probability threshold gates long entries, with price also required to be above a 15-period simple moving average. The strategy exits when the model probability weakens under a profit condition or when a trailing stop is reached.
The script sets trading costs and a fixed cash order size, but the document supplies no instrument, test window, performance report, or validation method. Training on a small rolling sample and using a probability threshold without reported out-of-sample evaluation leaves substantial uncertainty about signal quality. The trailing exit tracks the highest observed price and places its stop 10% below that high. The model is long-only, and its exit rule waits for equity to exceed the recorded entry equity before allowing the probability-based close, which may leave losing trades dependent on the trailing stop.
Key ideas
- The model uses six normalized price and volume features to estimate the chance of a positive future return.
- Training uses 50 historical samples and is refreshed periodically after an initial data warm-up.
- Long entries require the predicted probability to exceed a configurable threshold and price to be above a 15-period SMA.
- The strategy combines a probability-based close with a trailing stop set 10% below the running high.
- No backtest results or out-of-sample validation are provided, limiting conclusions about model performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.