(df, n)
return out(SETTINGS, df, result)
Trix
Trix
Trix
def TRIX(df, n):
    """
    Trix
    """
    EX1 = df['Close'].ewm(span=n, min_periods=n - 1).mean()
    EX2 = EX1.ewm(span=n, min_periods=n - 1).mean()
    EX3 = EX2.ewm(span=n, min_periods=n - 1).mean()
    i = 0
    ROC_l = [0]
    while i + 1 <= len(df) - 1:  # df.index[-1]:
        ROC = (EX3[i + 1] - EX3[i]) / EX3[i]
        ROC_l.append(ROC)
        i = i + 1
    result = pd.Series(ROC_l, name='Trix_' + str(n))
    return out(SETTINGS, df, result)
def TRIX ( df , n ) : EX1 = df [ 'Close' ] . ewm ( span = n , min_periods = n - 1 ) . mean ( ) EX2 = EX1 . ewm ( span = n , min_periods = n - 1 ) . mean ( ) EX3 = EX2 . ewm ( span = n , min_periods = n - 1 ) . mean ( ) i = 0 ROC_l = [ 0 ] while i + 1 <= len ( df ) - 1 : # df.index[-1]: ROC = ( EX3 [ i + 1 ] - EX3 [ i ] ) / EX3 [ i ] ROC_l . append ( ROC ) i = i + 1 result = pd . Series ( ROC_l , name = 'Trix_' + str ( n ) ) return out ( SETTINGS , df , result )