#ForexHomeExpert_image_slider1 #ForexHomeExpert_image_slider2 #ForexHomeExpert_image_slider3 #ForexHomeExpert_image_slider4

Wednesday, August 13, 2025

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 in TFIx[].
  • Per-timeframe Wingdings Arrow Overlay — per timeframe arrow uses windchar (char 108) and colored by inputs ArrowUp, ArrowDn, NTArrow.
  • Consensus Summary Signal — consensus computed in MFIMovementCalculation() and written to PowerMove[]. 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 in OnChartEvent().
  • 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 and UseSendnotify. Alerts are sent in Do_Alerts() when curAlert changes.
  • EA-Friendly Output — consensus exported to index buffer: SetIndexBuffer(0, mi.PowerMove, INDICATOR_DATA) so EAs can read 1.0 / -1.0.
  • Clean resource management — all indicator handles are released in OnDeinit() with IndicatorRelease() and chart objects removed via DeletedMFIObject().
Implementation note: This article is faithful to the 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

InputDescription
BarCalcIndicator period for MFI calculation (validated; fallback to 14 if <1)
ArrowUpColor for Up arrow (default clrMediumSeaGreen)
ArrowDnColor for Down arrow (default clrDeepPink)
NTArrowColor for No-Signal arrow (default clrGold)
f_modelFont model enum (Verdana, Bodoni_MT_Black)
alertsPopup alerts toggle (enum YN)
UseEmailAlertEmail alert toggle (enum YN)
UseSendnotifyPush 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.

GBPUSDH1_MFI_MTF

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 Calculation

MFIMovementCalculation(barCnt) loops through recent bars and for each bar it scans all tfxar timeframes:

  • Initialize up=0, dw=0, set Arwcolor[x] = NTArrow.
  • Call MFIDirectionScan() for each timeframe; increment up or dw and set per-timeframe arrow color.
  • After scanning all timeframes, if up > dw + 1 then PowerMove[i] = 1.0, TColor = ArrowUp, curAlert = 1. If dw > up + 1 then PowerMove[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.

5. Alerts

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."
6. UI / Panel / Interaction

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)

  1. Attach to any chart — the indicator scans all 21 timeframes regardless of the chart timeframe.
  2. Observe per-timeframe arrows — these show the short-term direction of MFI per timeframe as computed by MFIDirectionScan().
  3. Watch the consensus (PowerMove) — a large arrow appears in the panel if up > down + 1 or down > up + 1. The consensus is the main multi-timeframe trigger for trade consideration.
  4. Use alerts — enable alerts, UseEmailAlert, or UseSendnotify to be notified when consensus changes (note: alerts fire only once per minute per change).
  5. Switch timeframe via panel — click a timeframe label to instantly change the chart timeframe while the multi-timeframe scan remains active.
  6. Programmatic access — read PowerMove[] via iCustom() 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

Sunday, August 10, 2025

1. Introduction

The Commodity Channel Index Multi-Timeframe (CCI MTF) Indicator for MetaTrader 5 provides a comprehensive and compact way to read CCI momentum across all 21 standard timeframes (from M1 to MN1) on a single chart. Instead of switching charts and guessing whether shorter- or longer-term momentum supports your idea, this indicator calculates CCI on each timeframe independently and summarizes directional momentum with per-timeframe arrows plus a majority-based summary signal.

Each arrow corresponds to the directional assessment of the CCI for a particular timeframe:

  • 🟢 Green Arrow = Bullish momentum (CCI moving upward)
  • 🔴 Red Arrow = Bearish momentum (CCI moving downward)
  • Gold/Neutral Arrow = Neutral / weak/no dominant momentum

🚀 This tool is ideal for multi-timeframe traders, scalpers, and swing traders who want fast visual confirmation across the full timeframe (21 timeframes) spectrum before pulling the trigger.

2. About This Indicator

The Commodity Channel Index Multi-Timeframe Indicator for MT5 (CCI_MTF) 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.

CCI_MTF

3. Key Features

✅ Full 21-timeframe CCI scanning (M1 → MN1) in one indicator.
✅ Per-timeframe arrow overlays for quick visual scanning.
✅ Majority-based summary signal that reduces noise (summary arrow appears when up > down + 1 or down > up + 1).
✅ Customizable parameters: CCI calculation period (BarCalc), arrow colors, fonts.
✅ On-screen alerts + optional email and push notifications.
✅ Lightweight and optimized for MT5 — uses indicator handles (iCCI) and CopyBuffer for efficient buffer reading.
✅ Non-repainting behavior — uses closed bar data via CopyBuffer() for stable historical signals.
✅ Graphical Interface Panel for Timeframe Switching (via `OnChartEvent`)

4. How It Works (Behind the Scenes)

Commodity Channel Index (CCI) in a Nutshell

CCI is a momentum oscillator that measures the difference between a typical price and its moving average, normalized by mean absolute deviation. Common interpretation:

  • CCI > +100 → strong bullish momentum / overbought region
  • CCI < -100 → strong bearish momentum / oversold region

5. Multi-Timeframe Signal Logic

The indicator operates in two main steps:

  1. Create a handle for the CCI on each timeframe using iCCI() and keep those handles in an array (one per timeframe).
  2. For each bar the indicator examines, read the most recent closed CCI value(s) using CopyBuffer() and determine whether the CCI is rising or falling on that timeframe. Count the timeframes that are rising (up) vs falling (down). When the count for one direction exceeds the other by more than one (up > down + 1 or down > up + 1) a summary arrow is shown.

6. Relevant Code Snippets

Technical Overview: How the Indicator Works


//--
enum YN
  {
   No,
   Yes
  };
//--
enum fonts
  {
   Verdana,
   Bodoni_MT_Black
  };
//--
//-- Input Parameter
//---
input group   "====  Indicator Period Calculation  ===="
input int                BarCalc = 14;                // Input Indicator Period
input group   "====  Indicator Color and Font   ===="
input color              ArrowUp = clrMediumSeaGreen; // Arrow Up Color
input color              ArrowDn = clrDeepPink;       // Arrow Down Color
input color              NTArrow = clrGold;           // Arrow No Signal
input fonts              f_model = Bodoni_MT_Black;   // Select Font Model
input group   "====  Input parameters for alerts  ===="
input YN                  alerts = Yes;               // Display Alerts Pop-up on Chart (Yes) or (No)
input YN           UseEmailAlert = No;                // Email Alert (Yes) or (No)
input YN           UseSendnotify = No;                // Send Notification (Yes) or (No)
//---

Timeframe Management

The indicator prepares and manages handles for all standard MT5 timeframes:


   virtual void      CCI_MTF_Config(void)
     {
      //--
      ENUM_TIMEFRAMES TFIx[]= {PERIOD_M1,PERIOD_M2,PERIOD_M3,PERIOD_M4,PERIOD_M5,PERIOD_M6,PERIOD_M10,PERIOD_M12,PERIOD_M15,
                               PERIOD_M20,PERIOD_M30,PERIOD_H1,PERIOD_H2,PERIOD_H3,PERIOD_H4,PERIOD_H6,PERIOD_H8,PERIOD_H12,
                               PERIOD_D1,PERIOD_W1,PERIOD_MN1};
      tfxar=ArraySize(TFIx);
      ArrayResize(TFId,tfxar,tfxar);
      ArrayResize(Arwcolor,tfxar,tfxar);
      ArrayCopy(TFId,TFIx,0,0,WHOLE_ARRAY);
      //--
      string TFxc[]= {"M1","M2","M3","M4","M5","M6","M10","M12","M15","M20","M30","H1",                   "H2","H3","H4","H6","H8","H12","D1","W1","MN1"}; // 21 Timeframes
      //--
      ArrayResize(hCCI,tfxar,tfxar);
      ArrayResize(TFSc,tfxar,tfxar);
      ArrayCopy(TFSc,TFxc,0,0,WHOLE_ARRAY);
      //--
      if(BarCalc<1)
        {
         CCI_period=14;
         PrintFormat("Incorrect value for input variable BarCalc = %d. Indicator will use value %d for calculations.",
                  BarCalc,CCI_period);
        }
      else
         CCI_period=BarCalc;
      //--
      ttlbars=BarCalc*3+3;
      //--
      for(int x=0; x<tfxar; x++)
        hCCI[x]=iCCI(Symbol(),TFId[x],CCI_period,PRICE_TYPICAL); // Handle of iCCI Indicator on each timeframe
      //--
      DeletedCCIObject();
      CCIMovementCalculation(25);
      PositionCore();
      //--
      if(display)
         DrawCCIObject();
      //---
     }
   //---

Signal Extraction Logic

Each timeframe is scanned using:


   //---
   //---
   int               CCIDirectionScan(const ENUM_TIMEFRAMES stf,int shift) // Scan OBV Direction
     {
      //--
      int ret=0;
      int rise=1,
          down=-1;
      //--
      int br=shift+2;
      double res=0.0;
      UpdatePrice(stf);
      //--
      double CCI[];
      ArrayResize(CCI,br,br);
      ArraySetAsSeries(CCI,true);
      //--
      int xx=TFIndexArray(stf);
      CopyBuffer(hCCI[xx],0,0,br,CCI);
      //--
      if(CCI[shift]>CCI[shift+1]) ret=rise;
      if(CCI[shift]<CCI[shift+1]) ret=down;
      //--
      return(ret);
      //---
     } //-end CCIDirectionScan()
   //---

Consensus Calculation Logic.


   //---
   void              CCIMovementCalculation(int barCnt) // Scan the direction of iCCI on each timeframe
     {
      //--
      ArrayResize(PowerMove,barCnt,barCnt);
      ArraySetAsSeries(PowerMove,true);
      //--
      for(int i=barCnt-1; i>=0; i--)
        {
         up=0;
         dw=0;
         //--
         for(int x=0; x<tfxar; x++)
           {
            Arwcolor[x]=NTArrow;
            PowerMove[i]=0.0;
            int PPM=CCIDirectionScan(TFId[x],0);
            if(PPM>0)
              {
               up++;
               Arwcolor[x]=ArrowUp;
              }
            if(PPM<0)
              {
               dw++;
               Arwcolor[x]=ArrowDn;
              }
            if(x==tfxar-1)
              {
               if(up>dw+1)
                 {
                  PowerMove[i]=1.0;
                  TColor=ArrowUp;
                  curAlert=1;
                 }
               if(dw>up+1)
                 {
                  PowerMove[i]=-1.0;
                  TColor=ArrowDn;
                  curAlert=-1;
                 }
              }
           }
        }
      //--
      return;
      //---
     } //-end CCIMovementCalculation()
   //---
/*
This logic ensures that only dominant directional consensus (not slight differences) triggers a clear summary signal.
*/

Indicator signal calculation starts from OnCalculate(...)


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   ResetLastError();
   //--
   int limit;
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;
   if(limit>mi.ttlbars)
      limit=mi.ttlbars;
   if(limit-3<=1)
      limit=3;
   //--
   mi.CCIMovementCalculation(limit);
   //--
   if(alerts==Yes||UseEmailAlert==Yes||UseSendnotify==Yes)
     {
       mi.curmin=mi.ThisTime(mi.min);
       if(mi.curmin!=mi.prvmin && mi.curAlert==1 && mi.curAlert!=mi.prvAlert)
         {
           string AlertTxt="The strength of the CCI movement appears to be Rise.";
           mi.Do_Alerts(AlertTxt);
           mi.prvAlert=mi.curAlert;
           mi.prvmin=mi.curmin;
         }
       if(mi.curmin!=mi.prvmin && mi.curAlert==-1 && mi.curAlert!=mi.prvAlert)
         {
           string AlertTxt="The strength of the CCI movement appears to be Down.";
           mi.Do_Alerts(AlertTxt);
           mi.prvAlert=mi.curAlert;
           mi.prvmin=mi.curmin;
         }
     }
   //--
   if(mi.display)
     mi.DrawCCIObject();
   //---
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//---------//

Function DrawCCIObject() – Drawing multi-timeframe CCI results.


   //---
   void              DrawCCIObject(void)
     {
      //--
CreateButtonTemplate(CI,ObjName+"Template",397,66,STYLE_SOLID,9,BORDER_RAISED,clrMistyRose,clrLavenderBlush,clrWhite,bcor,corx,cory,true);
      for(int x=0; x<tfhalf; x++)
        {
         CreateArrowLabel(CI,ObjName+"_win_arrow_"+string(x),CharToString((uchar)windchar),"Wingdings",windsize,Arwcolor[x],bcor,
                             txttf+horizL1+(x*scaleX)+offsetX+x,vertiL1,true,"Arrow_"+TFSc[x]);
         CreateButtonClick(CI,TFSc[x],27,15,font_mode,fontSize,BORDER_FLAT,TFSc[x],clrBurlyWood,clrSilver,clrBlue,
                              bcor,txttf+horizL2+(x*scaleA)+offsetX,vertiL2,true,
                              "Change Timeframe to : "+TFSc[x]);
        }
      for(int x=tfhalf, x2=0; x<tfxar; x++, x2++)
        {
         CreateArrowLabel(CI,ObjName+"_win_arrow_"+string(x),CharToString((uchar)windchar),"Wingdings",windsize,Arwcolor[x],bcor,
                             txttf+horizL3+(x2*scaleX)+offsetX+x2,vertiL3,true,"Arrow_"+TFSc[x]);
         CreateButtonClick(CI,TFSc[x],27,15,font_mode,fontSize,BORDER_FLAT,TFSc[x],clrBurlyWood,clrSilver,clrBlue,
                              bcor,txttf+horizL4+(x2*scaleA)+offsetX,vertiL4,true,
                              "Change Timeframe to : "+TFSc[x]);
         //--
         if(x==20)
           {
            int arrowChar=TColor==ArrowUp ? 200 : TColor==ArrowDn ? 202 : windchar;
            CreateArrowLabel(CI,ObjName+"_tfx_arrow_"+string(x+1),"Move",font_mode,fontSize,clrBlue,bcor,
                                519+horizL5,vertiL5,true,"Move");
            CreateArrowLabel(CI,ObjName+"_win_arrow_"+string(x+1),CharToString((uchar)arrowChar),"Wingdings",15,TColor,bcor,
                                522+horizL6,vertiL6,true,"Arrow Indicator Movement");
           }
        }
      DisplayButtonClick("X");
      CreateButtonTemplate(CI,ObjName+"TemplateName1",17,15,STYLE_SOLID,1,BORDER_FLAT,clrMistyRose,clrLavenderBlush,clrWhite,bcor,TNamex,TNamey1,true);
      CreateButtonTemplate(CI,ObjName+"TemplateName2",17,15,STYLE_SOLID,1,BORDER_FLAT,clrMistyRose,clrLavenderBlush,clrWhite,bcor,TNamex,TNamey2,true);
      CreateButtonTemplate(CI,ObjName+"TemplateName3",17,15,STYLE_SOLID,1,BORDER_FLAT,clrMistyRose,clrLavenderBlush,clrWhite,bcor,TNamex,TNamey3,true);
      CreateArrowLabel(CI,ObjName+"_name1",hName1,font_mode,fontSize+1,clrBlue,bcor,TNamexn,TNamey1n,true,hName1);
      CreateArrowLabel(CI,ObjName+"_name2",hName2,font_mode,fontSize+1,clrBlue,bcor,TNamexn,TNamey2n,true,hName2);
      CreateArrowLabel(CI,ObjName+"_name3",hName3,font_mode,fontSize+1,clrBlue,bcor,TNamexn,TNamey3n,true,hName3);
      //--
      if(corpos==postop)
        {
          DisplayButtonClick("cstar");
          DisplayButtonClick("arbot");
        }
      if(corpos==posbot)
        {
          DisplayButtonClick("cstar");
          DisplayButtonClick("artop");
        }
      //--
      return;
      //---
     } //-end DrawCCIObject()
   //---
 //- This function is responsible for creating labels on the chart for each timeframe, with colors according to Overbought (green), Oversold (red), or No Signal (gold) Neutral conditions.

Dynamic Timeframe Panel OnChartEvent() Fuction

The indicator creates a clickable panel on the chart containing labels for all 21 timeframes. When a label (e.g., "H4") is clicked, the internal reference timeframe for analysis is updated, and the timeframe is changed to H4.

This makes it easy for the user to interact with the indicator dynamically.


//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
//--- handling CHARTEVENT_CLICK event ("Clicking the chart")
   ResetLastError();
//--
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      //--- if "X" button is click
      if(sparam=="X")
        {
         mi.DeletedCCIObject();
         //--- unpress the button
         ObjectSetInteger(mi.CI,"X",OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,"X",OBJPROP_ZORDER,0);
         //--
         mi.display=false;
         ObjectDelete(mi.CI,"X");
         mi.DisplayPanelButton();
        }
      //--- if "cstar" button is click
      if(sparam==mi.cstar)
        {
         mi.DeletedCCIObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.cstar,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.cstar,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         if(mi.corpos==mi.posbot) ObjectDelete(mi.CI,mi.arbot);
         if(mi.corpos==mi.postop) ObjectDelete(mi.CI,mi.artop);
         mi.DrawCCIObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if "artop" button is click
      if(sparam==mi.artop)
        {
         mi.DeletedCCIObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.artop,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.artop,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         ObjectDelete(mi.CI,mi.artop);
         mi.PanelPosChange(mi.postop);
         //--
         ObjectDelete(mi.CI,"X");
         mi.DisplayButtonClick("arbot");
         mi.DrawCCIObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if "arbot" button is click
      if(sparam==mi.arbot)
        {
         mi.DeletedCCIObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.arbot,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.arbot,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         ObjectDelete(mi.CI,mi.arbot);
         mi.PanelPosChange(mi.posbot);
         //--
         ObjectDelete(mi.CI,"X");
         mi.DisplayButtonClick("artop");
         mi.DrawCCIObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if TF button is click
      //--
      if(sparam==mi.TFSc[0])
        {
         mi.ChangeChartSymbol(mi.TFSc[0],mi.TFId[0]);
        }
      //--
      if(sparam==mi.TFSc[1])
        {
         mi.ChangeChartSymbol(mi.TFSc[1],mi.TFId[1]);
        }
      //--
      if(sparam==mi.TFSc[2])
        {
         mi.ChangeChartSymbol(mi.TFSc[2],mi.TFId[2]);
        }
      //--
      if(sparam==mi.TFSc[3])
        {
         mi.ChangeChartSymbol(mi.TFSc[3],mi.TFId[3]);
        }
      //--
      if(sparam==mi.TFSc[4])
        {
         mi.ChangeChartSymbol(mi.TFSc[4],mi.TFId[4]);
        }
      //--
      if(sparam==mi.TFSc[5])
        {
         mi.ChangeChartSymbol(mi.TFSc[5],mi.TFId[5]);
        }
      //--
      if(sparam==mi.TFSc[6])
        {
         mi.ChangeChartSymbol(mi.TFSc[6],mi.TFId[6]);
        }
      //--
      if(sparam==mi.TFSc[7])
        {
         mi.ChangeChartSymbol(mi.TFSc[7],mi.TFId[7]);
        }
      //--
      if(sparam==mi.TFSc[8])
        {
         mi.ChangeChartSymbol(mi.TFSc[8],mi.TFId[8]);
        }
      //--
      if(sparam==mi.TFSc[9])
        {
         mi.ChangeChartSymbol(mi.TFSc[9],mi.TFId[9]);
        }
      //--
      if(sparam==mi.TFSc[10])
        {
         mi.ChangeChartSymbol(mi.TFSc[10],mi.TFId[10]);
        }
      //--
      if(sparam==mi.TFSc[11])
        {
         mi.ChangeChartSymbol(mi.TFSc[11],mi.TFId[11]);
        }
      //--
      if(sparam==mi.TFSc[12])
        {
         mi.ChangeChartSymbol(mi.TFSc[12],mi.TFId[12]);
        }
      //--
      if(sparam==mi.TFSc[13])
        {
         mi.ChangeChartSymbol(mi.TFSc[13],mi.TFId[13]);
        }
      //--
      if(sparam==mi.TFSc[14])
        {
         mi.ChangeChartSymbol(mi.TFSc[14],mi.TFId[14]);
        }
      //--
      if(sparam==mi.TFSc[15])
        {
         mi.ChangeChartSymbol(mi.TFSc[15],mi.TFId[15]);
        }
      //--
      if(sparam==mi.TFSc[16])
        {
         mi.ChangeChartSymbol(mi.TFSc[16],mi.TFId[16]);
        }
      //--
      if(sparam==mi.TFSc[17])
        {
         mi.ChangeChartSymbol(mi.TFSc[17],mi.TFId[17]);
        }
      //--
      if(sparam==mi.TFSc[18])
        {
         mi.ChangeChartSymbol(mi.TFSc[18],mi.TFId[18]);
        }
      //--
      if(sparam==mi.TFSc[19])
        {
         mi.ChangeChartSymbol(mi.TFSc[19],mi.TFId[19]);
        }
      //--
      if(sparam==mi.TFSc[20])
        {
         mi.ChangeChartSymbol(mi.TFSc[20],mi.TFId[20]);
        }
      //--
     }
//---
  } //-end OnChartEvent()
//---------//

7. How to Use It

  1. Attach the Indicator — Add CCI_MTF to any chart (e.g., EURUSD H1).
  2. Configure Settings — Open the indicator inputs to set BarCalc, choose arrow colors, font, and turn alerts on/off.
  3. Indicator wiil Interpret Signals — Look for alignment across timeframes and the summary arrow.
  4. Confirm with Price Action — Validate with swing structure, support/resistance, or another momentum/confirmation indicator (moving averages, RSI, etc.).
  5. Trend-following entry: — enter in direction of majority summary arrow on a pullback in your execution timeframe.
  6. Counter-trend: — trade only with defined risk and confluence (e.g., bullish divergence on CCI + summary turning bullish).

8. FAQ

Q1: What does the indicator measure?
A1: It measures the direction of the CCI on each timeframe — whether the recent closed CCI values are moving upward or downward — then aggregates those direction votes into a majority-based summary.

Q2: How is the summary arrow calculated?
A2: The indicator counts how many timeframes show “up” vs “down.” If up > down + 1, a summary up arrow is shown. If down > up + 1, a summary down arrow is shown. This reduces false signals from single-timeframe noise.

Q3: Does this indicator repaint?
A3: No. It uses CopyBuffer() to read closed-bar values from iCCI handles, which prevents repainting and ensures stable historical signals.

Q4: Which CCI period does it use?
A4: The default BarCalc (period) is configurable. Many traders use 14 as a starting point, but you can change it to suit your strategy.

Q5: Can I get alerts when the summary changes?
A5: Yes. The indicator includes on-screen alerts and optional email and push notifications (controlled by alerts, UseEmailAlert, and UseSendnotify inputs).

Q6: Is it resource heavy?
A6: No. The indicator uses MT5 indicator handles (iCCI) and CopyBuffer() calls efficiently. It is designed to be lightweight even while scanning 21 timeframes.

Q7: Can I change which timeframes are scanned?
A7: The indicator creates a clickable panel on the chart containing labels for all 21 timeframes (M1 → MN1). When a label (e.g., "H8") is clicked, the internal reference timeframe for analysis is updated, and the timeframe is changed to H8.

Q8: How to combine it with other indicators?
A8: Good compliment indicators are moving averages (for trend direction), RSI (for momentum confirmation), or price action signals for entry timing.

Q9: Suitable for which instruments?
A9: Works on forex, indices, commodities, stocks, and crypto — any instrument supported by MT5.

9. Conclusion

The Commodity Channel Index Multi-Timeframe (CCI_MTF) Indicator for MT5 gives traders an organized, low-noise way to read momentum across the entire range of MT5 timeframes. By using a majority-vote method and reliable closed-bar buffer reads, it delivers practical signals for both scalpers and swing traders. Combine it with price-action validation or a complementary indicator to refine entries and exits.

We hope that this article and the CCI_MTF or Commodity Channel 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 CCI_MTF indicator: Commodity Channel 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: Commodity Channel 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

Friday, August 8, 2025

1. Introduction

Fractals are one of the classic tools introduced by legendary trader Bill Williams. These simple yet powerful markers are used to identify local swing highs and lows in price action. When used correctly, Fractals can help traders pinpoint reversal areas or breakout setups.

However, Fractals plotted on lower timeframes are often prone to noise and false signals. This is where the concept of multi-timeframe analysis becomes important.

The Fractals Multi-Timeframe Indicator for MT5 allows traders to overlay fractal signals from a higher timeframe directly onto the current chart. This provides cleaner, more reliable market structure references — without needing to constantly switch timeframes.

The Fractals Multi-Timeframe Indicator for MT5 (Fractals_MTF) Indicator for MetaTrader 5 provides directional signals from all 21 standard timeframes, ranging from M1 to MN1.

For each timeframe, it displays a directional arrow object (`OBJ_ARROW`) using Wingdings character 108:

🟢 Green arrow = upward ADX signal
🔴 Red arrow = downward ADX signal

After gathering these signals, the indicator calculates a consensus summary using a unique logic:
If the number of **up** signals is greater than **down + 1**, the indicator plots a larger **Wingdings 217** upward arrow * If the number of **down** signals is greater than **up + 1**, it plots a larger **Wingdings 218** downward arrow

This enables traders to view a high-confidence trend direction based on multi-timeframe Fractals indicator analysis directly on the main chart.

2. About This Indicator

The Fractals Multi-Timeframe Indicator for MT5 (Fractals_MTF) 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

3. Visual Example

Here is a sample chart showing the indicator in action:

NZDUSDH1_FRA_MTF

4. Key Features:

✅ 21-Timeframe Fractals Scanning
✅ Wingdings Arrows Overlay (per timeframe)
✅ Summary Arrow with Up/Down Consensus Calculation
✅ Color Customization for Each Signal
✅ Built-in Alerts (pop-up, email, mobile)
✅ Graphical Interface Panel for Timeframe Switching (via `OnChartEvent`)

Inputs and Parameters

| Input | Description |
| --------------- | ------------------------------------------ |
| `ArrowUp` | Color of up signal arrow |
| `ArrowDn` | Color of down signal arrow |
| `NTArrow` | Color of neutral arrow (default) |
| `f_model` | Font type for arrows (usually "Wingdings") |
| `alerts` | Enable/disable alert popups |
| `UseEmailAlert` | Enable email alerts |
| `UseSendnotify` | Enable push notification alerts |

Why Multi-Timeframe Fractals Matters?

Fractals are powerful in identifying **waves of price movement strength** but lack responsiveness in **trend consistency** across multiple timeframes. This custom Fractals_MTF indicator solved this:

📈 Confirm trading signals across all timeframes
⚠️ Avoid sideways or weak markets using visual confirmation
🚨 Detect strong breakouts supported by multiple timeframe trend directions

Using **all 21 timeframes** (from M1 to MN1) ensures broad trend consistency in your decision-making process.

5. Technical Overview: How the Indicator Works

Timeframe Management


   //---
   virtual void      Fractals_MTF_Config(void)
     {
      //--
      ENUM_TIMEFRAMES TFId[] = {PERIOD_M1, PERIOD_M2, ..., PERIOD_MN1};
      tfxar=ArraySize(TFIx);  // total 21 timeframes
      ArrayResize(TFId,tfxar,tfxar);
      ArrayCopy(TFId,TFIx,0,0,WHOLE_ARRAY);
      //--
      for(int x=0; x<tfxar; x++)
        hFRA[x]=iFractals(Symbol(),TFId[x]); // Handle of iFractals Indicator on each timeframe
      //--
      DeletedFRAObject();
      FRAMovementCalculation(25);
      PositionCore();
      //--
      if(display)
         DrawFRAObject();
      //---
     }
   //---
/*
Handles for all timeframe-specific Fractals  indicators are stored in `hFRA[]` and initialized inside `OnInit()` using `iFractals()` for each timeframe.
*/

Signal Extraction Logic

Each timeframe is scanned using:


   //---
   int FRADirectionScan(const ENUM_TIMEFRAMES stf,int shift) // Scan iFractals Direction
     {
      //--
      int ret=0;
      int rise=1,
          down=-1;
      //--
      int br=fbar;
      double res=0.0;
      UpdatePrice(stf);
      //--
      double FRAUp[];
      double FRADw[];
      ArrayResize(FRAUp,br,br);
      ArrayResize(FRADw,br,br);
      //--
      int xx=TFIndexArray(stf);
      CopyBuffer(hFRA[xx],0,0,br,FRAUp);
      CopyBuffer(hFRA[xx],1,0,br,FRADw);
      //--
      ArraySetAsSeries(FRAUp,true);
      ArraySetAsSeries(FRADw,true);
      //--
      int fup=br-1,
          fdw=br-1;
      //--
      for(int x=br-1; x>=0; x--)
        {
          if(FRAUp[x]!=EMPTY_VALUE) fup=x;
          if(FRADw[x]!=EMPTY_VALUE) fdw=x;
        }
      //--
      if(fdw<fup && fdw>shift) ret=rise; //
      if(fup<fdw && fup>shift) ret=down; // 
      //--
      return(ret);
      //---
     } //-end FRADirectionScan()
   //---

Consensus Calculation Logic.


   //---
   void FRAMovementCalculation(int barCnt) // Scan the direction of iFractals on each timeframe
     {
      //--
      ArrayResize(PowerMove,barCnt,barCnt);
      ArraySetAsSeries(PowerMove,true);
      //--
      for(int i=barCnt-1; i>=0; i--)
        {
         up=0;
         dw=0;
         //--
         for(int x=0; x<tfxar; x++)
           {
            Arwcolor[x]=NTArrow;
            PowerMove[i]=0.0;
            int PPM=FRADirectionScan(TFId[x],0);
            if(PPM>0)
              {
               up++;
               Arwcolor[x]=ArrowUp;
              }
            if(PPM<0)
              {
               dw++;
               Arwcolor[x]=ArrowDn;
              }
            if(x==tfxar-1)
              {
               if(up>dw+1)
                 {
                  PowerMove[i]=1.0;
                  TColor=ArrowUp;
                  curAlert=1;
                 }
               if(dw>up+1)
                 {
                  PowerMove[i]=-1.0;
                  TColor=ArrowDn;
                  curAlert=-1;
                 }
              }
           }
        }
      //--
      return;
      //---
     } //-end FRAMovementCalculation()
   //---
/*
This logic ensures that only dominant directional consensus (not slight differences) triggers a clear summary signal.
*/

Dynamic Timeframe Panel (OnChartEvent)

The indicator creates a clickable panel on the chart containing labels for all 21 timeframes. When a label (e.g., "H4") is clicked, the internal reference timeframe for analysis is updated.

This makes it easy for the user to interact with the indicator dynamically.


//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
//--- handling CHARTEVENT_CLICK event ("Clicking the chart")
   ResetLastError();
//--
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      //--- if "X" button is click
      if(sparam=="X")
        {
         mi.DeletedFRAObject();
         //--- unpress the button
         ObjectSetInteger(mi.CI,"X",OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,"X",OBJPROP_ZORDER,0);
         //--
         mi.display=false;
         ObjectDelete(mi.CI,"X");
         mi.DisplayPanelButton();
        }
      //--- if "cstar" button is click
      if(sparam==mi.cstar)
        {
         mi.DeletedFRAObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.cstar,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.cstar,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         if(mi.corpos==mi.posbot) ObjectDelete(mi.CI,mi.arbot);
         if(mi.corpos==mi.postop) ObjectDelete(mi.CI,mi.artop);
         mi.DrawFRAObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if "artop" button is click
      if(sparam==mi.artop)
        {
         mi.DeletedFRAObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.artop,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.artop,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         ObjectDelete(mi.CI,mi.artop);
         mi.PanelPosChange(mi.postop);
         //--
         ObjectDelete(mi.CI,"X");
         mi.DisplayButtonClick("arbot");
         mi.DrawFRAObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if "arbot" button is click
      if(sparam==mi.arbot)
        {
         mi.DeletedFRAObject();
         mi.DisplayPanelButton();
         //--- unpress the button
         ObjectSetInteger(mi.CI,mi.arbot,OBJPROP_STATE,false);
         ObjectSetInteger(mi.CI,mi.arbot,OBJPROP_ZORDER,0);
         if(!mi.display)
            mi.display=true;
         ObjectDelete(mi.CI,mi.arbot);
         mi.PanelPosChange(mi.posbot);
         //--
         ObjectDelete(mi.CI,"X");
         mi.DisplayButtonClick("artop");
         mi.DrawFRAObject();
         //--
         ChartRedraw(mi.CI);
        }
      //--- if TF button is click
      //--
      if(sparam==mi.TFSc[0])
        {
         mi.ChangeChartSymbol(mi.TFSc[0],mi.TFId[0]);
        }
      //--
      if(sparam==mi.TFSc[1])
        {
         mi.ChangeChartSymbol(mi.TFSc[1],mi.TFId[1]);
        }
      //--
      if(sparam==mi.TFSc[2])
        {
         mi.ChangeChartSymbol(mi.TFSc[2],mi.TFId[2]);
        }
      //--
      if(sparam==mi.TFSc[3])
        {
         mi.ChangeChartSymbol(mi.TFSc[3],mi.TFId[3]);
        }
      //--
      if(sparam==mi.TFSc[4])
        {
         mi.ChangeChartSymbol(mi.TFSc[4],mi.TFId[4]);
        }
      //--
      if(sparam==mi.TFSc[5])
        {
         mi.ChangeChartSymbol(mi.TFSc[5],mi.TFId[5]);
        }
      //--
      if(sparam==mi.TFSc[6])
        {
         mi.ChangeChartSymbol(mi.TFSc[6],mi.TFId[6]);
        }
      //--
      if(sparam==mi.TFSc[7])
        {
         mi.ChangeChartSymbol(mi.TFSc[7],mi.TFId[7]);
        }
      //--
      if(sparam==mi.TFSc[8])
        {
         mi.ChangeChartSymbol(mi.TFSc[8],mi.TFId[8]);
        }
      //--
      if(sparam==mi.TFSc[9])
        {
         mi.ChangeChartSymbol(mi.TFSc[9],mi.TFId[9]);
        }
      //--
      if(sparam==mi.TFSc[10])
        {
         mi.ChangeChartSymbol(mi.TFSc[10],mi.TFId[10]);
        }
      //--
      if(sparam==mi.TFSc[11])
        {
         mi.ChangeChartSymbol(mi.TFSc[11],mi.TFId[11]);
        }
      //--
      if(sparam==mi.TFSc[12])
        {
         mi.ChangeChartSymbol(mi.TFSc[12],mi.TFId[12]);
        }
      //--
      if(sparam==mi.TFSc[13])
        {
         mi.ChangeChartSymbol(mi.TFSc[13],mi.TFId[13]);
        }
      //--
      if(sparam==mi.TFSc[14])
        {
         mi.ChangeChartSymbol(mi.TFSc[14],mi.TFId[14]);
        }
      //--
      if(sparam==mi.TFSc[15])
        {
         mi.ChangeChartSymbol(mi.TFSc[15],mi.TFId[15]);
        }
      //--
      if(sparam==mi.TFSc[16])
        {
         mi.ChangeChartSymbol(mi.TFSc[16],mi.TFId[16]);
        }
      //--
      if(sparam==mi.TFSc[17])
        {
         mi.ChangeChartSymbol(mi.TFSc[17],mi.TFId[17]);
        }
      //--
      if(sparam==mi.TFSc[18])
        {
         mi.ChangeChartSymbol(mi.TFSc[18],mi.TFId[18]);
        }
      //--
      if(sparam==mi.TFSc[19])
        {
         mi.ChangeChartSymbol(mi.TFSc[19],mi.TFId[19]);
        }
      //--
      if(sparam==mi.TFSc[20])
        {
         mi.ChangeChartSymbol(mi.TFSc[20],mi.TFId[20]);
        }
      //--
     }
//---
  } //-end OnChartEvent()
//---------//

How to Use

1. **Attach to Any Chart** (e.g., EURUSD H1)
2. **Adjust the Inputs**
3. **Observe Directional Arrows** per timeframe on your chart
4. **Watch Summary Signal Arrow** (center chart)
5. **Click Timeframe Labels** to change timeframe view instantly

6. Advantages and Limitations

Advantages:
- Adds structure to noisy lower timeframes
- Visual confirmation of support/resistance
- Doesn’t repaint once the fractal bar closes

⚠️ Limitations:
- Fractals do **repaint** until the full pattern forms (2 candles after center)
- May lag in fast-moving markets
- This limitation is overcome by using the multi-timeframe Fractal indicator.

7. Final Thoughts

The Fractals Multi-Timeframe Indicator for MT5 brings an edge to traders who rely on market structure. Whether you trade breakouts, reversals, or trends — having higher timeframe swing points in sight makes your chart more informative and actionable.

The Fractals Multi-Timeframe Indicator for MT5 offers a complete solution for traders who want to understand trend strength across all timeframes simultaneously. Using a unique formula that scans and weighs up/down movement across 21 timeframes, it delivers a summary arrow signal that simplifies complex data into an actionable visual and removes the multi-timeframe Fractal indicator limitation.

With features like dynamic chart interaction, visual arrows, alerts, and a lightweight design, this tool is ideal for discretionary and algorithmic traders alike.

Try it in your next trading session — and gain a clearer view of what the big players are watching.

We hope that this article and the Fractals_MTF or Fractals 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 Fractals_MTF indicator: Fractals 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: Fractals 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

Featured Post

How to create a simple Multi-Currency Expert Advisor using MQL5 with Zigzag and RSI Indicators Signal

Introduction The Expert Advisor discussed in this article is a multi-currency trading robot that uses the Zigzag and RSI indicators. It fol...