(df, n, price='Close')
return out(SETTINGS, df, result)
Rate of Change
Rate of Change
Rate of Change
def ROC(df, n, price='Close'):
    """
    Rate of Change
    """
    M = df[price].diff(n - 1)
    N = df[price].shift(n - 1)
    result = pd.Series(M / N, name='ROC_' + str(n))
    return out(SETTINGS, df, result)
def ROC ( df , n , price = 'Close' ) : M = df [ price ] . diff ( n - 1 ) N = df [ price ] . shift ( n - 1 ) result = pd . Series ( M / N , name = 'ROC_' + str ( n ) ) return out ( SETTINGS , df , result )