chop#

chop(high, low, close, length=None, atr_length=None, ln=None, scalar=None, drift=None, offset=None, **kwargs)[source]#

Choppiness Index (CHOP)

The Choppiness Index was created by Australian commodity trader E.W. Dreiss and is designed to determine if the market is choppy (trading sideways) or not choppy (trading within a trend in either direction). Values closer to 100 implies the underlying is choppier whereas values closer to 0 implies the underlying is trending.

Sources:

https://www.tradingview.com/scripts/choppinessindex/ https://www.motivewave.com/studies/choppiness_index.htm

Calculation:
Default Inputs:

length=14, scalar=100, drift=1

HH = high.rolling(length).max() LL = low.rolling(length).min()

ATR_SUM = SUM(ATR(drift), length) CHOP = scalar * (LOG10(ATR_SUM) - LOG10(HH - LL)) CHOP /= LOG10(length)

Args:

high (pd.Series): Series of ‘high’s low (pd.Series): Series of ‘low’s close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 14 atr_length (int): Length for ATR. Default: 1 ln (bool): If True, uses ln otherwise log10. Default: False 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.