human
I am working on the file "Notebooks/quantopian_research_public/tutorials/pipeline/pipeline_tutorial_lesson_10.ipynb".
The first task is:
Further Example
Let's take another example where we build a momentum custom factor and use it to create a filter. We will then use that filter as a screen for our pipeline.
Let's start by defining a Momentum factor to be the division of the most recent close price by the close price from n days ago where n is the window_length.
Can you write Python program for it?
assistant
#Here is the Python program you requested.

class Momentum(CustomFactor):
    # Default inputs
    inputs = [USEquityPricing.close]

    # Compute momentum
    def compute(self, today, assets, out, close):
        out[:] = close[-1] / close[0]