This script is a visual dashboard designed for the MetaTrader platform. Its primary purpose is to display multiple timeframes of market momentum in a single, compact area on your trading chart, allowing you to see "big picture" trends and short-term fluctuations simultaneously without switching between different windows.
Core Functionality
The tool centers around the Money Flow Index (MFI), a momentum indicator that measures the flow of money into or out of an asset. Instead of showing you just one MFI value for the chart you are currently viewing, this script calculates and displays the MFI for seven different timeframes at once:
- 1 Minute (M1)
- 5 Minutes (M5)
- 15 Minutes (M15)
- 30 Minutes (M30)
- 1 Hour (H1)
- 4 Hours (H4)
- Daily (D1)
Visual Logic and Dashboard Design
The script creates a custom "Meter Block" on your screen, typically in the upper right or upper left corner (depending on your settings). Here is how it processes that information:
1. Dynamic Color Coding The script uses a multi-level color logic to interpret the MFI values. It categorizes the market momentum into six distinct zones based on specific thresholds:
- Extreme Highs: As the value reaches the upper limits, the display changes colors (e.g., moving from Yellow to Orange to Red) to alert you of potentially overbought conditions.
- Neutral Zones: Mid-range values are assigned distinct colors to show steady movement.
- Extreme Lows: As the value drops toward the bottom, the colors shift again (e.g., Blue or Dark Blue) to highlight potentially oversold conditions.
2. Real-Time Updates The script constantly monitors the live market data. Every time the price moves, it recalculates the MFI for all seven timeframes and updates the dashboard instantly. This provides a real-time "heartbeat" of the market across different scales.
3. User Interface Customization The logic includes several features to ensure the dashboard fits your specific trading style:
- Headings: You can toggle text labels (like "M1", "H1", etc.) to identify which value belongs to which timeframe.
- Positioning: The script includes coordinates to manage the spacing, padding, and shift of the dashboard elements so they do not overlap with other trading tools or price candles.
- Clean Up: The script includes a "cleanup" routine. When you remove the indicator from your chart, it automatically deletes all the labels and visual objects it created, leaving your chart clean.
Summary for the Trader
Think of this tool as a multi-speed speedometer. While your main chart shows you how fast the car is going right now (the current price action), this dashboard shows you the speed of the traffic ten blocks ahead, five miles away, and across the entire state—all at once. By watching the color shifts across these seven "meters," you can quickly identify if the short-term momentum aligns with the long-term trend.
//+------------------------------------------------------------------+
//| _TRO_Multi_Meter_Block |
//| |
//| Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne |
//| |
//| PO BOX 43575, TUCSON, AZ 85733 |
//| |
//| GIFT AND DONATIONS ACCEPTED |
//| |
//| therumpldone@gmail.com |
//+------------------------------------------------------------------+
//| |
//| go to www.kreslik.com for the latest indicator updates |
//+------------------------------------------------------------------+
//| |
//| Use www.efxgroup.com as your forex broker... |
//| ...tell them therumpledone sent you! |
//+------------------------------------------------------------------+
// thank you Xard777 from www.forex-tsd.com for showing me how to delete the objects properly.
// thank you mladen from www.forex-tsd.com for showing me I had a locals and global variables with same name
#property indicator_chart_window
extern bool Show_Heading = false;
extern string IndName = "MFI" ; // change
extern bool Corner_of_Chart_RIGHT_TOP = true;
extern int Shift_UP_DN =90;
extern int Adjust_Side_to_side = 20;
extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;
//*******************
// change inputs for your indicator
extern int MFI_PERIOD = 14;
//*******************
extern double Level5 = 95 ;
extern double Level4 = 80 ;
extern double Level3 = 50 ;
extern double Level2 = 20 ;
extern double Level1 = 5 ;
extern double Level0 = 0 ;
extern color colorLevel5 = Red ;
extern color colorLevel4 = Orange ;
extern color colorLevel3 = Yellow ;
extern color colorLevel2 = YellowGreen ;
extern color colorLevel1 = Blue ;
extern color colorLevel0 = DarkBlue;
//*******************
string ObjHead01,ObjHead02,ObjHead03,ObjHead04,ObjHead05,ObjHead06,ObjHead07,ObjHead08,ObjHead09;
string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009;
//+---------------
color MeterColor( double rsimeter )
{
if( rsimeter > Level5 ) { return( colorLevel5 ); }
if( rsimeter > Level4 ) { return( colorLevel4 ); }
if( rsimeter > Level3 ) { return( colorLevel3 ); }
if( rsimeter > Level2 ) { return( colorLevel2 ); }
if( rsimeter > Level1 ) { return( colorLevel1 ); }
return( colorLevel0 );
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//***********************************************************************************************************************
string LabelTime="";
if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }
int counted_bars=IndicatorCounted();
ObjHead01 = "MFIColHead01" + LabelTime ;
ObjHead02 = "MFIColHead02" + LabelTime ;
ObjHead03 = "MFIColHead03" + LabelTime ;
ObjHead04 = "MFIColHead04" + LabelTime ;
ObjHead05 = "MFIColHead05" + LabelTime ;
ObjHead06 = "MFIColHead06" + LabelTime ;
ObjHead07 = "MFIColHead07" + LabelTime ;
string MFI_ObjHead01 ="M1 " ;
string MFI_ObjHead02 ="M5 " ;
string MFI_ObjHead03 ="M15 " ;
string MFI_ObjHead04 =" M30 " ;
string MFI_ObjHead05 ="H1 " ;
string MFI_ObjHead06 ="H4 " ;
string MFI_ObjHead07 ="D1 " ;
if ( Show_Heading) {
if (Corner_of_Chart_RIGHT_TOP == true)
{
int Col01x = 130+Adjust_Side_to_side ;
int Col01y = 28+Shift_UP_DN ;
}
if (Corner_of_Chart_RIGHT_TOP == false)
{
Col01x = 119+Adjust_Side_to_side ;
Col01y = 24+Shift_UP_DN ;
}
int ColAdj = -20 ;
int Col02x = Col01x + ColAdj ;
int Col03x = Col01x + ColAdj*2 ;
int Col04x = Col01x + ColAdj*3 ;
int Col05x = Col01x + ColAdj*4 ;
int Col06x = Col01x + ColAdj*5 ;
int Col07x = Col01x + ColAdj*6 ;
ObjectCreate(ObjHead01, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead01,MFI_ObjHead01 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead01, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead01, OBJPROP_XDISTANCE, Col01x);
ObjectSet(ObjHead01, OBJPROP_YDISTANCE, Col01y);
ObjectCreate(ObjHead02, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead02,MFI_ObjHead02 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead02, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead02, OBJPROP_XDISTANCE, Col02x);
ObjectSet(ObjHead02, OBJPROP_YDISTANCE, Col01y);
ObjectCreate(ObjHead03, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead03,MFI_ObjHead03 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead03, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead03, OBJPROP_XDISTANCE, Col03x);
ObjectSet(ObjHead03, OBJPROP_YDISTANCE, 28+Shift_UP_DN);
ObjectCreate(ObjHead04, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead04,MFI_ObjHead04 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead04, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead04, OBJPROP_XDISTANCE, Col04x);
ObjectSet(ObjHead04, OBJPROP_YDISTANCE, 28+Shift_UP_DN);
ObjectCreate(ObjHead05, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead05,MFI_ObjHead05 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead05, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead05, OBJPROP_XDISTANCE, Col05x);
ObjectSet(ObjHead05, OBJPROP_YDISTANCE, 28+Shift_UP_DN);
ObjectCreate(ObjHead06, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead06,MFI_ObjHead06 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead06, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead06, OBJPROP_XDISTANCE, Col06x);
ObjectSet(ObjHead06, OBJPROP_YDISTANCE, 28+Shift_UP_DN);
ObjectCreate(ObjHead07, OBJ_LABEL, 0, 0, 0);
ObjectSetText(ObjHead07,MFI_ObjHead07 , 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(ObjHead07, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(ObjHead07, OBJPROP_XDISTANCE, Col07x);
ObjectSet(ObjHead07, OBJPROP_YDISTANCE, 28+Shift_UP_DN);
} // Show_Heading
//******************* change for your indicator ********************
//MFI Signals
double MFI_M1 = iMFI(Symbol(),1,MFI_PERIOD,0 ) ;
double MFI_M5 = iMFI(Symbol(),5,MFI_PERIOD,0 ) ;
double MFI_M15 = iMFI(Symbol(),15,MFI_PERIOD,0 ) ;
double MFI_M30 = iMFI(Symbol(),30,MFI_PERIOD,0 ) ;
double MFI_H1 = iMFI(Symbol(),60,MFI_PERIOD,0 ) ;
double MFI_H4 = iMFI(Symbol(),240,MFI_PERIOD,0 ) ;
double MFI_D1 = iMFI(Symbol(),1440,MFI_PERIOD,0 ) ;
string M1_MFI= "",M5_MFI= "", M15_MFI= "", M30_MFI= "", H1_MFI= "", H4_MFI= "", D1_MFI= "",PRC1;
color color_MFIm1,color_MFIm5,color_MFIm15,color_MFIm30,color_MFIm60,color_MFIm240,color_MFIm1440;
M1_MFI = "-"; color_MFIm1 = MeterColor( MFI_M1 ) ;
M5_MFI = "-"; color_MFIm5 = MeterColor( MFI_M5 ) ;
M15_MFI = "-"; color_MFIm15 = MeterColor( MFI_M15 ) ;
M30_MFI = "-"; color_MFIm30 = MeterColor( MFI_M30 ) ;
H1_MFI = "-"; color_MFIm60 = MeterColor( MFI_H1 ) ;
H4_MFI = "-"; color_MFIm240 = MeterColor( MFI_H4 ) ;
D1_MFI = "-"; color_MFIm1440 = MeterColor( MFI_D1 ) ;
Obj0002 = "SignalMFIM1t" + LabelTime ;
ObjectCreate(Obj0002, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0002,IndName, 7, "Tahoma Narrow", BarLabel_color);
ObjectSet(Obj0002, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0002, OBJPROP_XDISTANCE, 155+Adjust_Side_to_side);
ObjectSet(Obj0002, OBJPROP_YDISTANCE, 50+Shift_UP_DN);
Obj0003 = "SignalMFIM1" + LabelTime ;
ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0003, M1_MFI, 40, "Tahoma Narrow", color_MFIm1);
ObjectSet(Obj0003, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0003, OBJPROP_XDISTANCE, 130+Adjust_Side_to_side);
ObjectSet(Obj0003, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0004 = "SignalMFIM5" + LabelTime ;
ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0004, M5_MFI, 40, "Tahoma Narrow", color_MFIm5);
ObjectSet(Obj0004, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0004, OBJPROP_XDISTANCE, 110+Adjust_Side_to_side);
ObjectSet(Obj0004, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0005 = "SignalMFIM15" + LabelTime ;
ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0005, M15_MFI, 40, "Tahoma Narrow", color_MFIm15);
ObjectSet(Obj0005, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0005, OBJPROP_XDISTANCE, 90+Adjust_Side_to_side);
ObjectSet(Obj0005, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0006 = "SignalMFIM30" + LabelTime ;
ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0006, M30_MFI, 40, "Tahoma Narrow", color_MFIm30);
ObjectSet(Obj0006, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0006, OBJPROP_XDISTANCE, 70+Adjust_Side_to_side);
ObjectSet(Obj0006, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0007 = "SignalMFIM60" + LabelTime ;
ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0007, H1_MFI, 40, "Tahoma Narrow", color_MFIm60);
ObjectSet(Obj0007, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0007, OBJPROP_XDISTANCE, 50+Adjust_Side_to_side);
ObjectSet(Obj0007, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0008 = "SignalMFIM240" + LabelTime ;
ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0008, H4_MFI, 40, "Tahoma Narrow", color_MFIm240);
ObjectSet(Obj0008, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0008, OBJPROP_XDISTANCE, 30+Adjust_Side_to_side);
ObjectSet(Obj0008, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
Obj0009 = "SignalMFIM1440" + LabelTime ;
ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0009, D1_MFI, 40, "Tahoma Narrow", color_MFIm1440);
ObjectSet(Obj0009, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
ObjectSet(Obj0009, OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
ObjectSet(Obj0009, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll(0,OBJ_HLINE);
ObjectsDeleteAll(0,OBJ_TEXT);
ObjectsDeleteAll(0,OBJ_LABEL);
deleteObject();
//----
return(0);
}
void deleteObject()
{
//ObjectDelete(Obj0001);
ObjectDelete(Obj0002);
ObjectDelete(Obj0003);
ObjectDelete(Obj0004);
ObjectDelete(Obj0005);
ObjectDelete(Obj0006);
ObjectDelete(Obj0007);
ObjectDelete(Obj0008);
ObjectDelete(Obj0009);
ObjectDelete(ObjHead01);
ObjectDelete(ObjHead02);
ObjectDelete(ObjHead03);
ObjectDelete(ObjHead04);
ObjectDelete(ObjHead05);
ObjectDelete(ObjHead06);
ObjectDelete(ObjHead07);
//ObjectDelete(ObjHead08);
//ObjectDelete(ObjHead09);
}
Comments