Money Flow Index
"Money Flow Index (MFI)" by everget, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Money Flow Index (MFI) (v2.0), read 2026-11-15T18:28:39.491Z; source language v4.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
Money Flow Index (MFI) by everget, ported from Pine v4. Pane indicator with 3 plots, 2 marker series, 4 fills, 5 levels, bar/background colouring and 12 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2021-02-11; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// Copyright (c) 2021-present, Alex Orekhov (everget)
// ------------------------------------------------------------------------------------------------
// Original author: everget
// Original title: Money Flow Index (MFI)
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 4
// Fetched: 2026-11-15
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
// Converted by the FloScript converter from a Pine-compatible v4 source.
indicator("Money Flow Index", shorttitle="MFI", precision=2)
length = input.int(title="Length", defval=14, minval=1)
signalLength = input.int(title="Signal Length", defval=9, minval=1)
src = input.source(title="Source", defval=hlc3)
obLevel = input.int(title="Overbought Level", defval=80)
osLevel = input.int(title="Oversold Level", defval=20)
maxLevel = input.int(title="Max Level", defval=100)
minLevel = input.int(title="Min Level", defval=0)
showHistogram = input.bool(title="Show Histogram ?", defval=false)
highlightBreakouts = input.bool(title="Highlight Overbought/Oversold Breakouts ?", defval=true)
highlightCrossovers = input.bool(title="Highlight MFI/Signal Crossovers ?", defval=true)
highlightMiddleCrossovers = input.bool(title="Highlight Middle Line Crossovers ?", defval=true)
applyRibbonFilling = input.bool(title="Apply Ribbon Filling ?", defval=true)
mfi = ta.mfi(src, length)
signal = ta.ema(mfi, signalLength)
trendColor = mfi > signal ? #0ebb23 : color.red
smiColor = applyRibbonFilling ? trendColor : #ff3e7d
signalColor = applyRibbonFilling ? trendColor : #3c78d8
mfiPlot = plot(mfi, title="MFI", color=color.new(smiColor, 0))
signalPlot = plot(signal, title="Signal", color=color.new(signalColor, 0))
hist = mfi - signal
histColor = hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : hist[1] < hist ? #FFCDD2 : #EF5350
plot(showHistogram ? hist : na, title="Histogram", style=plot.style_columns, color=color.new(histColor, 0))
var color noneColor = color.new(color.white, 100)
maxLevelPlot = hline(maxLevel, title="Max Level", linestyle=hline.style_dotted, color=noneColor)
obLevelPlot = hline(obLevel, title="Overbought Level", linestyle=hline.style_dotted, color=#00796b)
hline(50, title="Middle Level", linestyle=hline.style_dotted, color=#989898)
osLevelPlot = hline(osLevel, title="Oversold Level", linestyle=hline.style_dotted, color=#f57f17)
minLevelPlot = hline(minLevel, title="Min Level", linestyle=hline.style_dotted, color=noneColor)
fill(obLevelPlot, osLevelPlot, title="Middle Zone", color=color.new(color.purple, 95))
obFillColor = mfi > obLevel and highlightBreakouts ? color.green : noneColor
osFillColor = mfi < osLevel and highlightBreakouts ? color.red : noneColor
fill(maxLevelPlot, obLevelPlot, title="Overbought Level Breakout", color=color.new(obFillColor, 85))
fill(minLevelPlot, osLevelPlot, title="Oversold Level Breakout", color=color.new(osFillColor, 85))
fillColor = applyRibbonFilling ? trendColor : noneColor
fill(mfiPlot, signalPlot, title="Ribbon", color=color.new(fillColor, 70))
middleCrossBgColor = highlightMiddleCrossovers ? (mfi > 50 ? color.green : color.red) : noneColor
bgcolor(color.new(middleCrossBgColor, 90), title="Middle Line Crossover Background")
plotshape(highlightCrossovers and ta.crossover(mfi, signal) ? mfi : na, title="MFI/Signal Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.green, 0))
plotshape(highlightCrossovers and ta.crossunder(mfi, signal) ? mfi : na, title="MFI/Signal Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.red, 0))
This file is under the Mozilla Public License 2.0; it is a port of the original by everget, with the original licence header kept and the changes made for FloScript noted in the file.
- v1
Library refresh 2026-11-15
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.