Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Have a custom factor as input for window_length in an other custom factor?

I wonder if it is possible to have a custom factor as input for window_length in an other custom factor? What I am trying to do is as follow: I want to screen for stocks that on yesterday closed above its volume weighted average price - where the volume weighted average price is calculated from the day with the highest price the equity has had (during some fixed look-back period).

Thus I have written a custom factor Days_Since_High that returns the number of days since the highest price during a fixed look-back period, and an other custom factor Anchored_VWAP that calculates the volume weighted average price from a fixed number of days ago. Then I tried to write avwap = Anchored_VWAP(window_length=Days_Since_High()). But that seems not to work.

Is it possible to achieve what I'm trying to do?

Most grateful for any help provided!