_TRO_Multi_Meter_Block

Download script
_TRO_Multi_Meter_Block

This script is designed as a multi-timeframe dashboard for the MetaTrader platform. It provides a visual summary of market trends across various timeframes simultaneously, allowing a trader to see a "big picture" overview without having to switch between different charts manually.

Core Functionality

Multi-Timeframe Monitoring The script automatically calculates and tracks the movement of Moving Averages (MA) across nine distinct timeframes: 1 Minute, 5 Minutes, 15 Minutes, 30 Minutes, 1 Hour, 4 Hours, Daily, Weekly, and Monthly. It monitors the relationship between a "Fast" moving average and a "Slow" moving average for each of these periods.

Visual Signaling System Instead of just providing raw numbers, the script translates the data into a clean, color-coded dashboard on your chart:

  • Bullish Signal: If the fast moving average is higher than the slow moving average, the indicator displays a specific color (defaulting to Lime).
  • Bearish Signal: If the fast moving average is lower than the slow moving average, it displays a different color (defaulting to Red).
  • Neutral/Equal Signal: If the two averages are perfectly equal, it displays a third color (defaulting to Yellow).

Dynamic Dashboard Interface The script creates a custom "Meter Block" on your screen. It features:

  • Customizable Placement: Users can choose which corner of the chart the dashboard appears in (e.g., top-right) and adjust its horizontal and vertical positioning.
  • Automatic Labeling: It creates text labels for each timeframe so the user always knows which signal belongs to which period.
  • Real-Time Updates: The dashboard refreshes automatically as new price data arrives, ensuring the trend colors are always current.

User Experience Features

  • Clean Visuals: The script uses specific fonts (Tahoma Narrow) and organized spacing to ensure that the various timeframe signals do not overlap or clutter the screen.
  • Automatic Cleanup: To keep your trading platform running smoothly, the script includes a "deinitialization" routine. This ensures that once the indicator is removed from a chart, all labels and dashboard elements are automatically deleted, leaving no "ghost" objects behind.
  • Customizable Inputs: While the logic remains consistent, users can adjust the speeds of the Moving Averages (Fast vs. Slow), as well as the colors used for each trend state to match their personal visual preferences.
Indicators Used
Moving average indicator
21 Views
0 Downloads
0 Favorites
_TRO_Multi_Meter_Block
//+------------------------------------------------------------------+ 
//|  _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 = true;
 
extern string IndName = "XYZ" ; // change

extern bool Corner_of_Chart_RIGHT_TOP = true;

extern int Shift_UP_DN =0; 
extern int Adjust_Side_to_side  = 20; // 20

extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;

extern color Up_color = Lime;
extern color Eq_color = Yellow;
extern color Dn_color = Red;
//******************* 
// change inputs for your indicator 

extern int MA_Fast = 1;
extern int MA_Slow = 5;
extern int MA_MODE = 1;
extern int MA_PRICE_TYPE = 0;

//*******************

string ObjHead01,ObjHead02,ObjHead03,ObjHead04,ObjHead05,ObjHead06,ObjHead07,ObjHead08,ObjHead09,ObjHead10,ObjHead11;  

string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009,Obj0010,Obj0011;  

//+------------------------------------------------------------------+
//| 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 = "XYZColHead01" + LabelTime ; 
   ObjHead02 = "XYZColHead02" + LabelTime ; 
   ObjHead03 = "XYZColHead03" + LabelTime ; 
   ObjHead04 = "XYZColHead04" + LabelTime ; 
   ObjHead05 = "XYZColHead05" + LabelTime ; 
   ObjHead06 = "XYZColHead06" + LabelTime ; 
   ObjHead07 = "XYZColHead07" + LabelTime ; 
   ObjHead08 = "XYZColHead08" + LabelTime ; 
   ObjHead09 = "XYZColHead09" + LabelTime ; 
         
   string XYZ_ObjHead01 ="M1 " ;
   string XYZ_ObjHead02 ="M5  " ;     
   string XYZ_ObjHead03 ="M15 " ;
   string XYZ_ObjHead04 =" M30 " ;
   string XYZ_ObjHead05 ="H1  " ;     
   string XYZ_ObjHead06 ="H4  " ;
   string XYZ_ObjHead07 ="D1  " ;
   string XYZ_ObjHead08 ="W1  " ;
   string XYZ_ObjHead09 ="MN1" ;   
   
   
   if ( Show_Heading) {         
    if (Corner_of_Chart_RIGHT_TOP == true)
    {  
    

   int Col01x = 170+Adjust_Side_to_side ;                 
   int Col01y = 28+Shift_UP_DN ;
   
   }
    if (Corner_of_Chart_RIGHT_TOP == false)
   { 
   
   Col01x = 159+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 ;    
   int Col08x = Col01x + ColAdj*7 ; 
   int Col09x = Col01x + ColAdj*8 ;     
   
       
   ObjectCreate(ObjHead01, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead01,XYZ_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,XYZ_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,XYZ_ObjHead03 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead03, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead03, OBJPROP_XDISTANCE, Col03x);
   ObjectSet(ObjHead03, OBJPROP_YDISTANCE, Col01y); 
 
   ObjectCreate(ObjHead04, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead04,XYZ_ObjHead04 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead04, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead04, OBJPROP_XDISTANCE, Col04x);
   ObjectSet(ObjHead04, OBJPROP_YDISTANCE, Col01y); 
   
   ObjectCreate(ObjHead05, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead05,XYZ_ObjHead05 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead05, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead05, OBJPROP_XDISTANCE, Col05x);
   ObjectSet(ObjHead05, OBJPROP_YDISTANCE, Col01y); 
            
   ObjectCreate(ObjHead06, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead06,XYZ_ObjHead06 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead06, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead06, OBJPROP_XDISTANCE, Col06x);
   ObjectSet(ObjHead06, OBJPROP_YDISTANCE, Col01y); 

   ObjectCreate(ObjHead07, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead07,XYZ_ObjHead07 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead07, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead07, OBJPROP_XDISTANCE, Col07x);
   ObjectSet(ObjHead07, OBJPROP_YDISTANCE, Col01y); 
         
   ObjectCreate(ObjHead08, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead08,XYZ_ObjHead08 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead08, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead08, OBJPROP_XDISTANCE, Col08x);
   ObjectSet(ObjHead08, OBJPROP_YDISTANCE, Col01y); 

   ObjectCreate(ObjHead09, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead09,XYZ_ObjHead09 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead09, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead09, OBJPROP_XDISTANCE, Col09x);
   ObjectSet(ObjHead09, OBJPROP_YDISTANCE, Col01y); 
       
} // Show_Heading

 //*******************   change for  your indicator ********************
   //XYZ Signals

   
   
    double XYZ_M1 = iMA(Symbol(),1,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_m1 = iMA(Symbol(),1,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_M5 = iMA(Symbol(),5,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_m5 = iMA(Symbol(),5,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_M15 = iMA(Symbol(),15,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_m15 = iMA(Symbol(),15,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_M30 = iMA(Symbol(),30,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_m30 = iMA(Symbol(),30,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_H1 = iMA(Symbol(),60,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_h1 = iMA(Symbol(),60,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_H4 = iMA(Symbol(),240,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_h4 = iMA(Symbol(),240,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_D1 = iMA(Symbol(),1440,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_d1 = iMA(Symbol(),1440,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);   
    double XYZ_W1 = iMA(Symbol(),10080,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_w1 = iMA(Symbol(),10080,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_MN1 = iMA(Symbol(),PERIOD_MN1,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
    double XYZ_mn1 = iMA(Symbol(),PERIOD_MN1,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);    
    
    
    string M1_XYZ= "",M5_XYZ= "", M15_XYZ= "", M30_XYZ= "", H1_XYZ= "", H4_XYZ= "", D1_XYZ= "",PRC1, W1_XYZ= "", MN1_XYZ= "";
    color  color_XYZm1,color_XYZm5,color_XYZm15,color_XYZm30,color_XYZm60,color_XYZm240,color_XYZm1440,color_XYZW1,color_XYZMN1;     
         
    
    if (XYZ_M1 > XYZ_m1) {M1_XYZ= "-";color_XYZm1 = Up_color; }
    if (XYZ_M1 < XYZ_m1) {M1_XYZ= "-";color_XYZm1 = Dn_color; }
    if (XYZ_M1 == XYZ_m1) {M1_XYZ= "-";color_XYZm1 = Eq_color; }
        
    if (XYZ_M5 > XYZ_m5) {M5_XYZ= "-";color_XYZm5 = Up_color; }
    if (XYZ_M5 < XYZ_m5) {M5_XYZ= "-";color_XYZm5 = Dn_color; }
    if (XYZ_M5 == XYZ_m5) {M5_XYZ= "-";color_XYZm5 = Eq_color; }
       
    if (XYZ_M15 > XYZ_m15) {M15_XYZ= "-";color_XYZm15 = Up_color; }
    if (XYZ_M15 < XYZ_m15) {M15_XYZ= "-";color_XYZm15 = Dn_color; }
    if (XYZ_M15 == XYZ_m15) {M15_XYZ= "-";color_XYZm15 = Eq_color; }
        
    if (XYZ_M30 > XYZ_m30) {M30_XYZ= "-";color_XYZm30 = Up_color; }
    if (XYZ_M30 < XYZ_m30) {M30_XYZ= "-";color_XYZm30 = Dn_color; }
    if (XYZ_M30 == XYZ_m30) {M30_XYZ= "-";color_XYZm30 = Eq_color; }
        
    if (XYZ_H1 > XYZ_h1) {H1_XYZ= "-";color_XYZm60 = Up_color; }
    if (XYZ_H1 < XYZ_h1) {H1_XYZ= "-";color_XYZm60 = Dn_color; }
    if (XYZ_H1 == XYZ_h1) {H1_XYZ= "-";color_XYZm60 = Eq_color; }
        
    if (XYZ_H4 > XYZ_h4) {H4_XYZ= "-";color_XYZm240 = Up_color; }
    if (XYZ_H4 < XYZ_h4) {H4_XYZ= "-";color_XYZm240 = Dn_color; }
    if (XYZ_H4 == XYZ_h4) {H4_XYZ= "-";color_XYZm240 = Eq_color; }
             
    if (XYZ_D1 > XYZ_d1) {D1_XYZ= "-";color_XYZm1440 = Up_color; }
    if (XYZ_D1 < XYZ_d1) {D1_XYZ= "-";color_XYZm1440 = Dn_color; }
    if (XYZ_D1 == XYZ_d1) {D1_XYZ= "-";color_XYZm1440 = Eq_color; }
        
    if (XYZ_W1 > XYZ_W1) {W1_XYZ= "-";color_XYZW1 = Up_color; }
    if (XYZ_W1 < XYZ_w1) {W1_XYZ= "-";color_XYZW1 = Dn_color; }    
    if (XYZ_W1 == XYZ_w1) {W1_XYZ= "-";color_XYZW1 = Eq_color; }
    
    if (XYZ_MN1 > XYZ_MN1) {MN1_XYZ= "-";color_XYZMN1 = Dn_color; }
    if (XYZ_MN1 < XYZ_mn1) {MN1_XYZ= "-";color_XYZMN1 = Dn_color; } 
    if (XYZ_MN1 == XYZ_mn1) {MN1_XYZ= "-";color_XYZMN1 = Eq_color; }     
    
    int Col00x = Col01x + 20 ;
    int Col00y = 50+Shift_UP_DN ;
    
    Col01y = 20+Shift_UP_DN ;
    
   Obj0002 = "SignalXYZM1t" + 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, Col00x);
   ObjectSet(Obj0002, OBJPROP_YDISTANCE, Col00y);  // 50+Shift_UP_DN

   Obj0003 = "SignalXYZM1" + LabelTime ;        
           ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0003, M1_XYZ, 40, "Tahoma Narrow",  color_XYZm1);
   ObjectSet(Obj0003, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0003, OBJPROP_XDISTANCE, Col01x);
   ObjectSet(Obj0003, OBJPROP_YDISTANCE, Col01y); 

   Obj0004 = "SignalXYZM5" + LabelTime ;          
           ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0004, M5_XYZ, 40, "Tahoma Narrow",  color_XYZm5);
   ObjectSet(Obj0004, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0004, OBJPROP_XDISTANCE, Col02x);
   ObjectSet(Obj0004, OBJPROP_YDISTANCE, Col01y); 
      
   Obj0005 = "SignalXYZM15" + LabelTime ; 
   ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0005, M15_XYZ, 40, "Tahoma Narrow",  color_XYZm15);
   ObjectSet(Obj0005, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0005, OBJPROP_XDISTANCE, Col03x);
   ObjectSet(Obj0005, OBJPROP_YDISTANCE, Col01y); 
      
   Obj0006 = "SignalXYZM30" + LabelTime ; 
   ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0006, M30_XYZ, 40, "Tahoma Narrow",  color_XYZm30);
   ObjectSet(Obj0006, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0006, OBJPROP_XDISTANCE, Col04x);
   ObjectSet(Obj0006, OBJPROP_YDISTANCE, Col01y); 

   Obj0007 = "SignalXYZM60" + LabelTime ;      
           ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0007, H1_XYZ, 40, "Tahoma Narrow",  color_XYZm60);
   ObjectSet(Obj0007, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0007, OBJPROP_XDISTANCE, Col05x);
   ObjectSet(Obj0007, OBJPROP_YDISTANCE, Col01y); 

   Obj0008 = "SignalXYZM240" + LabelTime ;          
           ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0008, H4_XYZ, 40, "Tahoma Narrow",  color_XYZm240);
   ObjectSet(Obj0008, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0008, OBJPROP_XDISTANCE, Col06x);
   ObjectSet(Obj0008, OBJPROP_YDISTANCE, Col01y);

   Obj0009 = "SignalXYZM1440" + LabelTime ;    
           ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0009, D1_XYZ, 40, "Tahoma Narrow",  color_XYZm1440);
   ObjectSet(Obj0009, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0009, OBJPROP_XDISTANCE, Col07x);
   ObjectSet(Obj0009, OBJPROP_YDISTANCE, Col01y);
   
   Obj0010 = "SignalXYZW1" + LabelTime ;    
           ObjectCreate(Obj0010, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0010, W1_XYZ, 40, "Tahoma Narrow",  color_XYZW1);
   ObjectSet(Obj0010, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0010, OBJPROP_XDISTANCE, Col08x);
   ObjectSet(Obj0010, OBJPROP_YDISTANCE, Col01y);   
   
   Obj0011 = "SignalXYZMN1" + LabelTime ;    
           ObjectCreate(Obj0011, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0011, MN1_XYZ, 40, "Tahoma Narrow",  color_XYZMN1);
   ObjectSet(Obj0011, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0011, OBJPROP_XDISTANCE, Col09x);
   ObjectSet(Obj0011, OBJPROP_YDISTANCE, Col01y); 
     
 //----
   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(Obj0010); 
ObjectDelete(Obj0011); 

ObjectDelete(ObjHead01);  
ObjectDelete(ObjHead02); 
ObjectDelete(ObjHead03); 
ObjectDelete(ObjHead04); 
ObjectDelete(ObjHead05); 
ObjectDelete(ObjHead06); 
ObjectDelete(ObjHead07); 
ObjectDelete(ObjHead08); 
ObjectDelete(ObjHead09); 
 
  }

Comments