Pine Script (TradingView)
This is a TradingView Pine Script example for this indicator. Paste it into the TradingView Pine Editor, add it to your chart, and adjust inputs for your market and timeframe.
//@version=6
indicator("Money Flow Index (MFI)", overlay=false)
length = input.int(14, "MFI Length")
mfi = ta.mfi(hlc3, length)
longSignal = ta.crossover(mfi, 20)
shortSignal = ta.crossunder(mfi, 80)
plotshape(longSignal, style=shape.triangleup, location=location.bottom, color=color.green, size=size.small)
plotshape(shortSignal, style=shape.triangledown, location=location.top, color=color.red, size=size.small)
hline(80, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(50, "Mid", color=color.gray, linestyle=hline.style_dotted)
hline(20, "Oversold", color=color.green, linestyle=hline.style_dashed)
plot(mfi, "MFI", color=color.new(color.teal, 0))