Choosing Fixed-Horizon and Barrier Labels for Trading Models
Summary
The document discusses how to label future price movements for a trading prediction model. One approach checks whether the price is higher or lower at the end of a fixed interval; another labels a sample positive if price reaches a favorable level at any point during that interval. The latter resembles a trading opportunity but can give examples different effective horizons, complicating model assumptions and comparisons.
The answer recommends starting with simple directional labels for feature selection, optionally requiring a move large enough to clear the bid-ask spread and a margin. After selecting useful features, the model can target more complex events, such as reaching upper or lower barriers that represent take-profit and stop-loss rules. The proposed workflow then evaluates trading strategies through backtesting and cross-validation, and may iteratively refine labels to reflect strategies that perform well. The exchange offers a methodological suggestion rather than empirical evidence or a universal rule; label choice depends on the trading objective and should be evaluated in the full strategy context.
Key ideas
- Simple directional labels can make initial feature selection more manageable.
- A price-move threshold can account for spread and a required margin.
- Barrier-based labels can represent take-profit and stop-loss outcomes.
- Prediction quality and strategy profitability are separate evaluation steps.
- Labels may be refined iteratively after testing strategies.
Tags
Full text
# In your experience, when trying to predict something that occurs, do you model with a fixed time period? # In your experience, when trying to predict something that occurs, do you model with a fixed time period? Let's say you are building a simple model (like the classroom examples) of trying to predict, given past information, if the stock goes up or down in the future. One could, like in classroom examples, turn this into a classification problem, and encode 1 if stock goes up, 0 if unchanged, and -1 if stock goes down. When modeling such a model, in practice, would you: - Look at the ending prices of different fixed intervals, for example, 1 min, 1day, 2day, etc.. So if the stock price is higher exactly 1 min from now, you would encode this as a 1. - Or model so that at any point in time within 1min, 1day, 2day, the stock goes up in price. So let's say your time frame is 1min, and the stock goes up at the 30 second mark, but then goes back down and ends up negative, you would still encode it as a 1. In the class room, we tend to do the former. But I would imagine in practice that this would lead to some datamining of the time period for the response - as what time period would you choose? The latter makes more practical sense as you just care if there's an opportunity to trade at a higher price. But, effectively, the time period of the response is different for each example - not sure how that would affect any of the assumptions and results of statistical/ML models. Which would you say is more effective in practice? Thanks! ## Answer by alexprice (score 1) https://quant.stackexchange.com/a/55494 In time series prediction for trading there are two parts: ``` -prediction model -trading strategy based on it. ``` As for construction of prediction model, there are also two parts: ``` - feature selection (which can be very time-consuming) - actual prediction. ``` For feature selection the model should be simple and thus just predicting direction is more desirable.You can add threshold to direction i.e. y=0 unless next price> bid-ask spread plus some margin (at the end of some period). Once you selected the relevant features, you can ask your model to predict more complex event, such as hitting upper/lower barrier (emulating trading strategy with stop loss/ take profit) as described in De Prado's Book, in Triple-Barrier Method and in details in this post https://towardsdatascience.com/financial-machine-learning-part-1-labels-7eeed050f32e At the end when you have your backtested/cross-validated predicting model, you can adopt any trading strategy. Usually only small subset of tradings strategies based on your prediction model will be profitable enough.You can examine in detail these profitable trading strategies and then amend your labelling on step 1 to be more complex (i.e. include elements of your trading strategy), and repeat the whole process iteratively.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.