2017-12-23 7 views
-2

Ich versuche, einen Aroon-Indikator in Python mit Pandas zu machen. Allerdings bin ich falschen Wert bekommen ... könnte jemand wie zu Punkt helfen, wo ich falsch werde ...Wie man einen Aroon-Indikator mit Python-Pandas erstellt

import pandas as pd 
import Bitmex_OHLC 
import numpy as np 
import importlib 

def aroon(): 
    importlib.reload(Bitmex_OHLC) 
    df_aroon = Bitmex_OHLC.OHLC() 
    df_aroon['14L_min'] = df_aroon['low'].rolling(window=14,min_periods=0).min() 
    df_aroon['14H_max'] = df_aroon['high'].rolling(window=14,min_periods = 0).max() 
    df_aroon['ind'] = range(0,len(df_aroon)) 
    # recent_high = df_aroon.iloc[-1]["25d High"] 
    df_aroon['high_ind'] = df_aroon['ind'].where(df_aroon["14H_max"]==df_aroon['high']).fillna(method = 'ffill') 
    df_aroon['low_ind'] = df_aroon['ind'].where(df_aroon["14L_min"] == df_aroon['low']).fillna(method = 'ffill') 
    df_aroon['since_high'] = df_aroon['ind']-df_aroon['high_ind'] 
    df_aroon['since_low'] = df_aroon['ind'] - df_aroon['low_ind'] 
    df_aroon['up'] = (((14 - df_aroon['since_high'])/14) *100) 
    df_aroon['down'] = (((14 - df_aroon['since_low'])/14) * 100) 
    return (df_aroon) 

print(aroon().tail()) 

Der Wert (nach unten) Spalte sollte immer positiv und (since_low) Spalte sein sollte weniger als 14

Jede mögliche Hilfe geschätzt wird .. Thanx

https://dpaste.de/kJJW Error enter image description here code enter image description here

+0

Verwenden Sie die Bibliothek ta-lib in Python zum Erstellen von Bestandsindikatoren. Hier ist der Link https://github.com/mrjbq7/ta-lib –

Antwort

Verwandte Themen