Introduction
The Money Flow Index Multi-Timeframe (MFI_MTF) Indicator for MetaTrader 5 calculates and scans the Money Flow Index (MFI) on all 21 standard MT5 timeframes (M1 … MN1) and displays per-timeframe signals directly on the chart. The indicator creates a native iMFI
handle for every timeframe, draws Wingdings arrow labels per timeframe, and computes a single consensus summary signal (exported as PowerMove[]
) when a dominant directional majority exists. An on-chart clickable panel allows instant timeframe switching without reattaching the indicator.
Key Features
- 21-Timeframe MFI Scanning — MFI is calculated using
iMFI(Symbol(), TFId[x], MFI_period, VOLUME_TICK)
for each timeframe defined inTFIx[]
. - Per-timeframe Wingdings Arrow Overlay — per timeframe arrow uses
windchar
(char 108) and colored by inputsArrowUp
,ArrowDn
,NTArrow
. - Consensus Summary Signal — consensus computed in
MFIMovementCalculation()
and written toPowerMove[]
. Condition:up > down + 1
→ UP (1.0);down > up + 1
→ DOWN (-1.0). - Interactive On-Chart Panel — clickable timeframe buttons (
CreateButtonClick()
) and panel position controls (artop
/arbot
), handled inOnChartEvent()
. - Customizable Appearance — control font via input
f_model
(Verdana or Bodoni MT Black), arrow sizes (windsize
), and layout offsets (offsetX
,offsetY
). - Alerts — popup alerts plus optional email and push via
UseEmailAlert
andUseSendnotify
. Alerts are sent inDo_Alerts()
whencurAlert
changes. - EA-Friendly Output — consensus exported to index buffer:
SetIndexBuffer(0, mi.PowerMove, INDICATOR_DATA)
so EAs can read1.0 / -1.0
. - Clean resource management — all indicator handles are released in
OnDeinit()
withIndicatorRelease()
and chart objects removed viaDeletedMFIObject()
.
MFI_MTF.mq5
source (Roberto Jacobs, 2025-01-14). Variable names and behavior described below are taken directly from the source code.
Inputs and Parameters
Input | Description |
---|---|
BarCalc | Indicator period for MFI calculation (validated; fallback to 14 if <1) |
ArrowUp | Color for Up arrow (default clrMediumSeaGreen ) |
ArrowDn | Color for Down arrow (default clrDeepPink ) |
NTArrow | Color for No-Signal arrow (default clrGold ) |
f_model | Font model enum (Verdana , Bodoni_MT_Black ) |
alerts | Popup alerts toggle (enum YN ) |
UseEmailAlert | Email alert toggle (enum YN ) |
UseSendnotify | Push notification toggle (enum YN ) |
2. About This Indicator
The Money Flow Index Multi-Timeframe (MFI_MTF) Indicator for MetaTrader 5 utilizes a template and displays a panel on the chart.
Its function, operation, and usage are identical to the On Balance Volume Multi-Timeframe Indicator for MT5 (OBV_MTF) as detailed in the previous article. For a comprehensive guide on creating a multi-timeframe indicator, you can refer to the following resources: On Balance Volume Multi-Timeframe Indicator for MT5
🔁 Note: All multi-timeframe indicators developed by Forex Home Expert use this exact signal logic programs structure.
How It Works (implementation details)
1. Initialization
OnInit()
calls mi.MFI_MTF_Config()
. The config routine defines the timeframe array TFIx[]
and label array TFSc[]
, sets tfxar = ArraySize(TFIx)
, validates BarCalc
to set MFI_period
, computes ttlbars = BarCalc*3+3
, and creates an iMFI
handle for each timeframe:
hMFI[x] = iMFI(Symbol(), TFId[x], MFI_period, VOLUME_TICK);
2. Price and Buffer Management
The indicator keeps routines UpdatePrice()
and RefreshPrice()
to ensure arrays for OHLC, TIME, and VOLUME are prepared if needed. Crucially, MFI values are obtained from the indicator handles via CopyBuffer()
:
CopyBuffer(hMFI[index], 0, 0, br, MFI);
3. Per-timeframe Direction Scan
MFIDirectionScan(stf, shift)
copies br = shift + 2
MFI points and compares MFI[shift]
vs MFI[shift+1]
:
if (MFI[shift] > MFI[shift+1]) ret = 1; // rise
if (MFI[shift] < MFI[shift+1]) ret = -1; // down
This uses closed buffer values (historical indices), so past signals are based on confirmed data.
4. Consensus CalculationMFIMovementCalculation(barCnt)
loops through recent bars and for each bar it scans all tfxar
timeframes:
- Initialize
up=0
,dw=0
, setArwcolor[x] = NTArrow
. - Call
MFIDirectionScan()
for each timeframe; incrementup
ordw
and set per-timeframe arrow color. - After scanning all timeframes, if
up > dw + 1
thenPowerMove[i] = 1.0
,TColor = ArrowUp
,curAlert = 1
. Ifdw > up + 1
thenPowerMove[i] = -1.0
,TColor = ArrowDn
,curAlert = -1
.
The consensus buffer PowerMove[]
is written to indicator buffer index 0 so other programs (EAs) can read consensus signals.
Alerts are handled in OnCalculate()
after mi.MFIMovementCalculation(limit)
runs. If alerts are enabled, the indicator compares current minute (mi.ThisTime(mi.min)
) with the previously alerted minute and sends alerts only when the minute changes and curAlert
differs from prvAlert
. Messages are sent via Do_Alerts()
and contain these texts:
"The strength of the MFI movement appears to be Rise."
"The strength of the MFI movement appears to be Down."
DrawMFIObject()
draws the main rectangle template (panel), per-timeframe arrow labels (CreateArrowLabel()
), and clickable timeframe buttons (CreateButtonClick()
). The big consensus arrow uses Wingdings characters (tstar=217
or bstar=218
) and the per-timeframe arrows use windchar=108
. Clicking a timeframe button triggers OnChartEvent()
and the indicator calls ChangeChartSymbol()
which runs ChartSetSymbolPeriod(CI, Symbol(), stf)
to change the chart timeframe while preserving the indicator display.
How to Trade (code-faithful guidance)
- Attach to any chart — the indicator scans all 21 timeframes regardless of the chart timeframe.
- Observe per-timeframe arrows — these show the short-term direction of MFI per timeframe as computed by
MFIDirectionScan()
. - Watch the consensus (PowerMove) — a large arrow appears in the panel if
up > down + 1
ordown > up + 1
. The consensus is the main multi-timeframe trigger for trade consideration. - Use alerts — enable
alerts
,UseEmailAlert
, orUseSendnotify
to be notified when consensus changes (note: alerts fire only once per minute per change). - Switch timeframe via panel — click a timeframe label to instantly change the chart timeframe while the multi-timeframe scan remains active.
- Programmatic access — read
PowerMove[]
viaiCustom()
inside an EA to automate decisions based on consensus values (1.0 or -1.0).
Q/A Section
Q1: Which timeframes does the indicator scan?
A: All 21 standard MT5 timeframes declared in the code’s TFIx[]
array: M1, M2, M3, M4, M5, M6, M10, M12, M15, M20, M30, H1, H2, H3, H4, H6, H8, H12, D1, W1, MN1
.
Q2: How is the MFI period set?
A: The BarCalc
input sets the MFI period. If BarCalc < 1
the code falls back to a default MFI_period = 14
and prints a warning.
Q3: Does the indicator repaint?
A: No. The indicator uses CopyBuffer()
to read closed/historical MFI buffer values and compares MFI[shift]
against MFI[shift+1]
, so past signals are based on confirmed buffer values.
Q4: When are alerts triggered?
A: Alerts are triggered only when alerts are enabled, the minute changed since the last alert, and curAlert
differs from prvAlert
. The messages are generated in Do_Alerts()
.
Q5: How does the consensus logic decide direction?
A: After scanning all timeframes the code counts up
and dw
. Consensus UP is set when up > dw + 1
. Consensus DOWN is set when dw > up + 1
. This requires a margin greater than 1 to avoid marginal-majority triggers.
Q6: Can I change where the panel is located?
A: Yes. Use the on-panel buttons (artop
/ arbot
) to move the panel between top and bottom; this is handled by PanelPosChange()
.
Q7: Can an EA read the indicator output?
A: Yes — PowerMove[]
is assigned to the indicator buffer (index 0) via SetIndexBuffer(0, mi.PowerMove, INDICATOR_DATA)
, so external EAs can read it with iCustom()
.
Q8: Are external libraries required?
A: No. The indicator uses native MT5 functions only: iMFI
, CopyBuffer
, object creation APIs, ChartSetSymbolPeriod
, SendMail
, and SendNotification
.
Q9: Which characters are used for arrows?
A: Per-timeframe arrows use windchar = 108
(Wingdings char 108). The summary large arrows use tstar = 217
(up) and bstar = 218
(down).
Q10: What happens at deinit?
A: OnDeinit()
releases all iMFI
handles (IndicatorRelease(mi.hMFI[x])
), deletes drawn objects via mi.DeletedMFIObject()
, and calls ChartRedraw()
.
Final Words
The Money Flow Index Multi-Timeframe Indicator for MT5 indicator is a robust, non-repainting multi-timeframe MFI scanner designed for MT5. Its architecture separates per-timeframe signal extraction (MFIDirectionScan()
) from consensus generation (MFIMovementCalculation()
), exports the consensus buffer for EA integration, and offers an interactive panel for quick exploration. The indicator cleanly manages indicator handles and drawn objects on deinit and supports popup, email, and push notifications for live monitoring.
We hope that this article and the MFI_MTF or Money Flow Index Multi-Timeframe Indicator for MT5 program will be useful for traders in learning and generating new ideas for trading, who can ultimately make money from home by trading forex.
Thanks for reading this article.
Please download the MFI_MTF indicator: Money Flow Index Multi-Timeframe Indicator for MT5
If you are subscribed to my YouTube Channel, and would like to receive the source program of this article, please send a request via the Contact Us form page, and I will send it to your email, source code: Money Flow Index Multi-Timeframe Indicator for MT5
Don't forget to stop by and subscribe to Forex Home Experts YouTube Channel:
YouTube Channel: @ForexHomeExperts
YouTube Playlist: @ForexHomeExperts YouTube Playlist