Money Flow Index
MFI measures buying and selling pressure by considering both price and volume.
Method
tm.ta.mfi(source_high, source_low, source_close, source_volume, timeperiod)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source_high | pd.Series | High prices series | - |
source_low | pd.Series | Low prices series | - |
source_close | pd.Series | Close prices series | - |
source_volume | pd.Series | Volume series | - |
timeperiod | int | Number of periods for the indicator | 14 |
Outputs
Output | Type |
---|---|
mfi | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Money Flow Index mfi = tm.ta.mfi(data.high, data.low, data.close, data.volume, timeperiod=14)
# Get the last value and print last_value = mfi.iloc[-1] tm.log(f"Last value of Money Flow Index is {last_value}")
# Plot the values of mfi tm.plot(mfi, title="Money Flow Index", overlay=False)