slope#

slope(close, length=None, as_angle=None, to_degrees=None, vertical=None, offset=None, **kwargs)[source]#

Slope

Returns the slope of a series of length n. Can convert the slope to angle. Default: slope.

Sources: Algebra I

Calculation:
Default Inputs:

length=1

slope = close.diff(length) / length

if as_angle:

slope = slope.apply(atan) if to_degrees:

slope *= 180 / PI

Args:

close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 1 offset (int): How many periods to offset the result. Default: 0

Kwargs:

as_angle (value, optional): Converts slope to an angle. Default: False to_degrees (value, optional): Converts slope angle to degrees. Default: False fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.Series: New feature generated.