当前位置: 动力学知识库 > 问答 > 编程问答 >

python code for McGinley Dynamic Indicator

问题描述:

I need a python function for McGinley Dynamic Indicator. McGinley Dynamic indicator is calculated by this formula: Kindly help.

I have dataframe with columns: open, high, low, close. I want to join the result of the function to be added to my dataframe.

something like this:

def MD(df,n):

pmd = df['md'.shift(1)

k = float(.60)

x = df['close'] - pmd

y = ((df['close']/pmd)**4)

MD = pd.Series(pmd + (x/(k*n*y)), name = 'md')

df = df.join(MD)

return df

分享给朋友:
您可能感兴趣的文章:
随机阅读: