Skip to content

Instantly share code, notes, and snippets.

@jsrimr jsrimr/MACD.py
Created Sep 6, 2019

Embed
What would you like to do?
def fnMACD(m_Df, m_NumFast=12, m_NumSlow=26, m_NumSignal=9):
EMAFast = m_Df['c'].ewm( span = m_NumFast, min_periods = m_NumFast - 1).mean()
EMASlow = m_Df['c'].ewm( span = m_NumSlow, min_periods = m_NumSlow - 1).mean()
MACD = EMAFast - EMASlow
MACDSignal= MACD.ewm( span = m_NumSignal, min_periods = m_NumSignal-1).mean()
MACDDiff= MACD - MACDSignal
return MACDDiff.mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.