Filtering Predicted Stock Signals Before Backtesting
Summary
The document explains how to remove stocks from a model’s predicted buy signals when they fail a chosen condition. Its example filters out stocks whose return_5 value is below 1.05, so a signal containing three names could proceed with only the two that pass. The steps are to join the strategy signals with the return_5 data, apply the filter, and then restore the original ranking by sorting on score in descending order before sending the remaining signals to the backtest.
This is a practical workflow for adding a rule-based selection layer after prediction and before portfolio simulation. The document offers an illustrative threshold and sequence of operations, but no performance comparison or evidence that the threshold improves results. The return_5 field’s definition and timing are not explained, so users must verify that the data is available at the decision point and that the filter does not introduce look-ahead bias.
Key ideas
- Join predicted stock signals to the data field used for filtering.
- Remove candidates that fail the selected threshold.
- Restore the model’s original ranking before passing signals to the backtest.
- The example does not establish that its threshold improves performance or avoids look-ahead bias.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.