-
Notifications
You must be signed in to change notification settings - Fork 236
Description
https://github.com/mrjbq7/ta-lib/blob/master/docs/func_groups/momentum_indicators.md
MFI - Money Flow Index
NOTE: The MFI function has an unstable period.
real = MFI(high, low, close, volume, timeperiod=14)
however, if we check the DESCRIPTION of TA_SetUnstablePeriod(https://ta-lib.org/d_api/ta_setunstableperiod.html).
and then how the MFI is calculated:
https://www.investopedia.com/terms/m/mfi.asp
How to Calculate the Money Flow Index
There are several steps for calculating the Money Flow Index. If doing it by hand, using a spreadsheet is recommended.
Calculate the Typical Price for each of the last 14 periods.
For each period, mark whether the typical price was higher or lower than the prior period. This will tell you whether Raw Money Flow is positive or negative.
Calculate Raw Money Flow by multiplying the Typical Price by Volume for that period. Use negative or positive numbers depending on whether the period was up or down (see step above).
Calculate the Money Flow Ratio by adding up all the positive money flows over the last 14 periods and dividing it by the negative money flows for the last 14 periods.
Calculate the Money Flow Index (MFI) using the ratio found in step four.
Continue doing the calculations as each new period ends, using only the last 14 periods of data.
It's more like SMA, having look back period of 1 (compare 1st typical price is up/down with the prev typical price), rather than EMA (which will "remember" all the price effect on the current ema value all the way back to the very start).
I think this is a doc error: The MFI function has no unstable period.