I want to put a filter into my pipeline to exclude any stocks that have gapped up by more than 15% in the last x days. I was thinking I'd build the following custom factor logic:
- Pull in daily returns for
window_length = x
- Build a function
pct_changethat works out % change from previous open to current close
- Build the
computefunction with a for loop to run
pct_changeover the daily returns to create a list
- Output the maximum value from the list
I'd then build a filter in the pipeline.
I'm not the fastest of coders so wanted to get an idea of whether or not this is a feasible/good approach before I invest some time building it! Thanks in advance.