def movingMax(requestContext, seriesList, windowSize):
    """
    Graphs the moving maximum of a metric (or metrics) over a fixed number of
    past points, or a time interval.

    Takes one metric or a wildcard seriesList followed by a number N of
    datapoints or a quoted string with a length of time like '1hour' or '5min'
    (See ``from / until`` in the render\_api_ for examples of time formats).
    Graphs the maximum of the preceeding datapoints for each point on the
    graph.

    Example::

      &target=movingMax(Server.instance01.requests,10)
      &target=movingMax(Server.instance*.errors,'5min')

    """
    if not seriesList:
        return []
    windowInterval = None
    if isinstance(windowSize, six.string_types):
        delta = parseTimeOffset(windowSize)
        windowInterval = abs(delta.seconds + (delta.days * 86400))

    if windowInterval:
        previewSeconds = windowInterval
    else:
        previewSeconds = max([s.step for s in seriesList]) * int(windowSize)

    # ignore original data and pull new, including our preview
    # data from earlier is needed to calculate the early results
    newContext = requestContext.copy()
    newContext['startTime'] = (requestContext['startTime'] -
                               timedelta(seconds=previewSeconds))
    previewList = evaluateTokens(newContext, requestContext['args'][0])
    result = []

    for series in previewList:
        if windowInterval:
            windowPoints = windowInterval // series.step
        else:
            windowPoints = int(windowSize)

        if isinstance(windowSize, six.string_types):
            newName = 'movingMax(%s,"%s")' % (series.name, windowSize)
        else:
            newName = "movingMax(%s,%s)" % (series.name, windowSize)

        newSeries = TimeSeries(newName, series.start + previewSeconds,
                               series.end, series.step, [])
        newSeries.pathExpression = newName
        for i in range(windowPoints, len(series)):
            window = series[i - windowPoints:i]
            newSeries.append(safeMax(window))

        result.append(newSeries)

    return result

    Graphs the moving maximum of a metric (or metrics) over a fixed number of
    past points, or a time interval.

    Takes one metric or a wildcard seriesList followed by a number N of
    datapoints or a quoted string with a length of time like '1hour' or '5min'
    (See ``from / until`` in the render\_api_ for examples of time formats).
    Graphs the maximum of the preceeding datapoints for each point on the
    graph.

    Example::

      &target=movingMax(Server.instance01.requests,10)
      &target=movingMax(Server.instance*.errors,'5min')

    
graphite_api/functions.py