psl#

psl(close, open_=None, length=None, scalar=None, drift=None, offset=None, **kwargs)[source]#

Psychological Line (PSL)

The Psychological Line is an oscillator-type indicator that compares the number of the rising periods to the total number of periods. In other words, it is the percentage of bars that close above the previous bar over a given period.

Sources:

https://www.quantshare.com/item-851-psychological-line

Calculation:
Default Inputs:

length=12, scalar=100, drift=1

IF NOT open:

DIFF = SIGN(close - close[drift])

ELSE:

DIFF = SIGN(close - open)

DIFF.fillna(0) DIFF[DIFF <= 0] = 0

PSL = scalar * SUM(DIFF, length) / length

Args:

close (pd.Series): Series of ‘close’s open_ (pd.Series, optional): Series of ‘open’s length (int): It’s period. Default: 12 scalar (float): How much to magnify. Default: 100 drift (int): The difference period. Default: 1 offset (int): How many periods to offset the result. Default: 0

Kwargs:

fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.Series: New feature generated.