_TRO_Multi_Meter_MACD_v1

_TRO_Multi_Meter_MACD_v1

Overview

The _TRO_Multi_Meter_MACD is a specialized dashboard tool designed for MetaTrader. Instead of requiring you to switch between different timeframes manually to see how the market is performing, this script gathers that information into a single, organized visual display directly on your main trading chart.

It focuses specifically on the MACD (Moving Average Convergence Divergence), a popular momentum indicator used by traders to identify changes in the strength, direction, and speed of price movements.

How It Works

The logic of this script can be broken down into three primary functions:

1. Multi-Timeframe Data Gathering

The script simultaneously analyzes seven different timeframes: M1, M5, M15, M30, H1, H4, and D1. For every one of these periods, it calculates the "Main" and "Signal" lines of the MACD based on your chosen settings (Fast EMA, Slow EMA, and Signal SMA).

2. Dynamic Signal Logic

For each timeframe, the script evaluates the relationship between the Main line and the Signal line to determine the current trend:

  • Above Zero vs. Below Zero: It first checks if the MACD value is positive or negative.
  • Main vs. Signal: It then compares whether the Main line is currently above or below the Signal line.
  • Visual Coding: Based on these two factors, the script assigns a specific color to each timeframe's status. For example, it distinguishes between "Upward" trends above zero, "Downward" trends above zero, and their respective counterparts below zero.

3. Visual Dashboard Display

Rather than drawing complex lines across your chart, the script creates a clean, readable text display in a corner of your screen (default is the top-right).

  • Heading: It provides a clear row of labels showing the timeframes (M1 through D1).
  • Status Indicators: Below each timeframe label, it displays a visual indicator (a dash) colored specifically to match the trend detected by the logic described above.

Key Features for the User

  • At-a-Glance Analysis: You can see the "big picture" (Daily and Hourly trends) while simultaneously monitoring "scalping" timeframes (1-minute and 5-minute trends) without moving your eyes across different windows.
  • Customizable Appearance: Users can adjust the position of the dashboard on the chart, change the colors used for bullish and bearish signals, and modify the standard MACD periods to suit their specific trading style.
  • Automatic Cleanup: The script is designed to be tidy; when you remove it from your chart, it automatically deletes all the labels it created, ensuring your workspace remains clean.
Indicators Used
MACD Histogram
11 Views
0 Downloads
0 Favorites
_TRO_Multi_Meter_MACD_v1
//+------------------------------------------------------------------+ 
//|  _TRO_Multi_Meter_MACD                                           | 
//|                                                                  | 
//|   Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpldone@gmail.com                                         |  
//+------------------------------------------------------------------+ 

#property indicator_chart_window

extern bool Show_Heading = false;
 
extern string IndName = "MACD" ; // change

extern bool Corner_of_Chart_RIGHT_TOP = true;

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

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

//******************* 
// change inputs for your indicator 

string    MACD_Settings         = "=== MACD Settings ===";
extern int       MACDFast              =           12;  // MACD fast EMA period
extern int       MACDSlow              =           26;  // MACD slow EMA period
extern int       MACDSignal            =            9;  // MACD signal SMA period
extern color XUP_Above_0               = Lime ; 
extern color XDN_Above_0               = Tomato ; 
extern color XUP_Below_0               = Green ; 
extern color XDN_Below_0               = Red ; 

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



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

//+------------------------------------------------------------------+
//| 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();
   
if ( Show_Heading) {         
    if (Corner_of_Chart_RIGHT_TOP == true)
    {  
    
   Obj0001 = "Numbers" + LabelTime ; 
           ObjectCreate(Obj0001, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0001, "    M1   M5  M15  M30   H1    H4   D1", 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(Obj0001, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0001, OBJPROP_XDISTANCE, 17+Adjust_Side_to_side);
   ObjectSet(Obj0001, OBJPROP_YDISTANCE, 28+Shift_UP_DN); 
   }
    if (Corner_of_Chart_RIGHT_TOP == false)
   { 
           ObjectCreate(Obj0001, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0001, "   M1     M5   M15   M30   H1    H4    D1", 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(Obj0001, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0001, OBJPROP_XDISTANCE, 17+Adjust_Side_to_side);
   ObjectSet(Obj0001, OBJPROP_YDISTANCE, 24+Shift_UP_DN); 
    } 
} // Show_Heading

 //*******************   change for  your indicator ********************
   //MACD Signals

   

    
    string M1_MACD= "",M5_MACD= "", M15_MACD= "", M30_MACD= "", H1_MACD= "", H4_MACD= "", D1_MACD= "",PRC1;
    color  color_MACDm1,color_MACDm5,color_MACDm15,color_MACDm30,color_MACDH1,color_MACDH4,color_MACDD1;     
         
   
   double MACD_m_1=iMACD(NULL,PERIOD_M1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_1=iMACD(NULL,PERIOD_M1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_1 > 0 ) {   
      if ((MACD_m_1 > MACD_s_1)) { M1_MACD= "-";color_MACDm1 = XUP_Above_0 ; }
      if ((MACD_m_1 < MACD_s_1)) { M1_MACD= "-";color_MACDm1 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_1 > MACD_s_1)) { M1_MACD= "-";color_MACDm1 = XUP_Below_0 ; }
      if ((MACD_m_1 < MACD_s_1)) { M1_MACD= "-";color_MACDm1 = XDN_Below_0 ; } }   
 
   double MACD_m_5=iMACD(NULL,PERIOD_M5,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_5=iMACD(NULL,PERIOD_M5,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_5 > 0 ) {   
      if ((MACD_m_5 > MACD_s_5)) { M5_MACD= "-";color_MACDm5 = XUP_Above_0  ;}
      if ((MACD_m_5 < MACD_s_5)) { M5_MACD= "-";color_MACDm5 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_5 > MACD_s_5)) { M5_MACD= "-";color_MACDm5 = XUP_Below_0 ; }
      if ((MACD_m_5 < MACD_s_5)) { M5_MACD= "-";color_MACDm5 = XDN_Below_0 ; } }   
    
   double MACD_m_15=iMACD(NULL,PERIOD_M15,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_15=iMACD(NULL,PERIOD_M15,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_15 > 0 ) {   
      if ((MACD_m_15 > MACD_s_15)) { M15_MACD= "-";color_MACDm15 = XUP_Above_0 ; }
      if ((MACD_m_15 < MACD_s_15)) { M15_MACD= "-";color_MACDm15 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_15 > MACD_s_15)) { M15_MACD= "-";color_MACDm15 = XUP_Below_0 ; }
      if ((MACD_m_15 < MACD_s_15)) { M15_MACD= "-";color_MACDm15 = XDN_Below_0 ; } }   
 
   double MACD_m_30=iMACD(NULL,PERIOD_M30,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_30=iMACD(NULL,PERIOD_M30,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_30 > 0 ) {   
      if ((MACD_m_30 > MACD_s_30)) { M30_MACD= "-";color_MACDm30 = XUP_Above_0 ; }
      if ((MACD_m_30 < MACD_s_30)) { M30_MACD= "-";color_MACDm30 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_30 > MACD_s_30)) { M30_MACD= "-";color_MACDm30 = XUP_Below_0 ; }
      if ((MACD_m_30 < MACD_s_30)) { M30_MACD= "-";color_MACDm30 = XDN_Below_0 ; } }   
 
 
   double MACD_m_H1=iMACD(NULL,PERIOD_H1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_H1=iMACD(NULL,PERIOD_H1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_H1 > 0 ) {   
      if ((MACD_m_H1 > MACD_s_H1)) { H1_MACD= "-";color_MACDH1 = XUP_Above_0 ; }
      if ((MACD_m_H1 < MACD_s_H1)) { H1_MACD= "-";color_MACDH1 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_H1 > MACD_s_H1)) { H1_MACD= "-";color_MACDH1 = XUP_Below_0 ;  }
      if ((MACD_m_H1 < MACD_s_H1)) { H1_MACD= "-";color_MACDH1 = XDN_Below_0 ; } }   
      
   double MACD_m_H4=iMACD(NULL,PERIOD_H4,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_H4=iMACD(NULL,PERIOD_H4,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_H4 > 0 ) {   
      if ((MACD_m_H4 > MACD_s_H4)) { H4_MACD= "-";color_MACDH4 = XUP_Above_0 ; }
      if ((MACD_m_H4 < MACD_s_H4)) { H4_MACD= "-";color_MACDH4 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_H4 > MACD_s_H4)) { H4_MACD= "-";color_MACDH4 = XUP_Below_0 ; }
      if ((MACD_m_H4 < MACD_s_H4)) { H4_MACD= "-";color_MACDH4 = XDN_Below_0 ; } }   
       
   double MACD_m_D1=iMACD(NULL,PERIOD_D1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_MAIN,0);
   double MACD_s_D1=iMACD(NULL,PERIOD_D1,MACDFast,MACDSlow,MACDSignal,PRICE_CLOSE,MODE_SIGNAL,0);
   
   if( MACD_m_D1 > 0 ) {   
      if ((MACD_m_D1 > MACD_s_D1)) { D1_MACD= "-";color_MACDD1 = XUP_Above_0 ; }
      if ((MACD_m_D1 < MACD_s_D1)) { D1_MACD= "-";color_MACDD1 = XDN_Above_0 ; } }
   else {
      if ((MACD_m_D1 > MACD_s_D1)) { D1_MACD= "-";color_MACDD1 = XUP_Below_0 ; }
      if ((MACD_m_D1 < MACD_s_D1)) { D1_MACD= "-";color_MACDD1 = XDN_Below_0 ; } }   
 

      

    

   Obj0002 = "SignalMACDM1t" + 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 = "SignalMACDM1" + LabelTime ;        
           ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0003, M1_MACD, 40, "Tahoma Narrow",  color_MACDm1);
   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 = "SignalMACDM5" + LabelTime ;          
           ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0004, M5_MACD, 40, "Tahoma Narrow",  color_MACDm5);
   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 = "SignalMACDM15" + LabelTime ; 
   ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0005, M15_MACD, 40, "Tahoma Narrow",  color_MACDm15);
   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 = "SignalMACDM30" + LabelTime ; 
   ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0006, M30_MACD, 40, "Tahoma Narrow",  color_MACDm30);
   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 = "SignalMACDM60" + LabelTime ;      
           ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0007, H1_MACD, 40, "Tahoma Narrow",  color_MACDH1);
   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 = "SignalMACDM240" + LabelTime ;          
           ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0008, H4_MACD, 40, "Tahoma Narrow",  color_MACDH4);
   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 = "SignalMACDM1440" + LabelTime ;    
           ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0009, D1_MACD, 40, "Tahoma Narrow",  color_MACDD1);
   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); 
 
  }

Comments