(df, n)
return out(SETTINGS, df, result)
Coppock Curve
Coppock Curve
Coppock Curve
def COPP(df, n):
    """
    Coppock Curve
    """
    M = df['Close'].diff(int(n * 11 / 10) - 1)
    N = df['Close'].shift(int(n * 11 / 10) - 1)
    ROC1 = M / N
    M = df['Close'].diff(int(n * 14 / 10) - 1)
    N = df['Close'].shift(int(n * 14 / 10) - 1)
    ROC2 = M / N
    temp = ROC1 + ROC2
    result = pd.Series(temp.ewm(span=n, min_periods=n).mean(), name='Copp_' + str(n))
    return out(SETTINGS, df, result)
def COPP ( df , n ) : M = df [ 'Close' ] . diff ( int ( n * 11 / 10 ) - 1 ) N = df [ 'Close' ] . shift ( int ( n * 11 / 10 ) - 1 ) ROC1 = M / N M = df [ 'Close' ] . diff ( int ( n * 14 / 10 ) - 1 ) N = df [ 'Close' ] . shift ( int ( n * 14 / 10 ) - 1 ) ROC2 = M / N temp = ROC1 + ROC2 result = pd . Series ( temp . ewm ( span = n , min_periods = n ) . mean ( ) , name = 'Copp_' + str ( n ) ) return out ( SETTINGS , df , result )