(df, n)
return out(SETTINGS, df, result)
Keltner Channel
Keltner Channel
Keltner Channel
def KELCH(df, n):
    """
    Keltner Channel
    """
    temp = (df['High'] + df['Low'] + df['Close']) / 3
    KelChM = pd.Series(temp.rolling(n).mean(), name='KelChM_' + str(n))
    temp = (4 * df['High'] - 2 * df['Low'] + df['Close']) / 3
    KelChU = pd.Series(temp.rolling(n).mean(), name='KelChU_' + str(n))
    temp = (-2 * df['High'] + 4 * df['Low'] + df['Close']) / 3
    KelChD = pd.Series(temp.rolling(n).mean(), name='KelChD_' + str(n))
    result = pd.DataFrame([KelChM, KelChU, KelChD]).transpose()
    return out(SETTINGS, df, result)
def KELCH ( df , n ) : temp = ( df [ 'High' ] + df [ 'Low' ] + df [ 'Close' ] ) / 3 KelChM = pd . Series ( temp . rolling ( n ) . mean ( ) , name = 'KelChM_' + str ( n ) ) temp = ( 4 * df [ 'High' ] - 2 * df [ 'Low' ] + df [ 'Close' ] ) / 3 KelChU = pd . Series ( temp . rolling ( n ) . mean ( ) , name = 'KelChU_' + str ( n ) ) temp = ( - 2 * df [ 'High' ] + 4 * df [ 'Low' ] + df [ 'Close' ] ) / 3 KelChD = pd . Series ( temp . rolling ( n ) . mean ( ) , name = 'KelChD_' + str ( n ) ) result = pd . DataFrame ( [ KelChM , KelChU , KelChD ] ) . transpose ( ) return out ( SETTINGS , df , result )