_TRO_Multi_Meter_Block_v1
Download scriptThis script functions as a multi-timeframe visual dashboard for MetaTrader, designed to give traders a "bird's-eye view" of market trends across various intervals simultaneously. Instead of requiring you to switch between different charts to see what is happening on the 1-minute, 5-minute, or daily timeframe, this tool aggregates that information into a single display area on your current chart.
Core Functionality
Multi-Timeframe Analysis The script automatically calculates technical data for seven distinct timeframes:
- 1 Minute (M1)
- 5 Minutes (M5)
- 15 Minutes (M15)
- 30 Minutes (M30)
- 1 Hour (H1)
- 4 Hours (H4)
- Daily (D1)
Trend Detection Logic For every one of these timeframes, the script compares two different Moving Averages (a "Fast" and a "Slow" average). This is a classic technical analysis method used to determine momentum:
- Bullish Signal: If the Fast Moving Average is higher than the Slow Moving Average, the script identifies an upward trend.
- Bearish Signal: If the Fast Moving Average is lower than or equal to the Slow Moving Average, it identifies a downward trend.
Visual Dashboard Display The script generates a clean, text-based dashboard in a corner of your chart (defaulting to the top right).
- Color Coding: It uses color indicators to provide instant feedback—typically Lime (Green) for upward trends and Red for downward trends.
- Dynamic Labels: It lists the timeframes horizontally and places the corresponding trend signals underneath them. This allows you to see at a glance if the short-term momentum aligns with the long-term trend.
User Customization The script includes several settings that allow you to tailor the visual experience:
- Heading & Positioning: You can toggle the header on or off and choose which corner of the chart the dashboard appears in.
- Offset Adjustments: You can move the dashboard slightly up, down, left, or right to ensure it doesn't overlap with other indicators or price candles.
- Indicator Settings: While the script handles the logic, you can define the specific "Fast" and "Slow" periods, as well as the calculation methods (Price Type and Mode) for the Moving Averages used in the background.
Summary of Use
Essentially, this tool acts as a "Status Bar" for your trading. It simplifies complex data by summarizing the state of multiple timeframes into a single row of colored signals, helping you make informed decisions on whether the current price movement is supported by larger market trends.
//+------------------------------------------------------------------+
//| _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;
extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;
//*******************
// 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 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 = "XYZHead" + LabelTime ;
string XYZ_Head = " M1 M5 M15 M30 H1 H4 D1" ;
ObjectCreate(Obj0001, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0001,XYZ_Head , 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, XYZ_Head , 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 ********************
//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);
string M1_XYZ= "",M5_XYZ= "", M15_XYZ= "", M30_XYZ= "", H1_XYZ= "", H4_XYZ= "", D1_XYZ= "",PRC1;
color color_XYZm1,color_XYZm5,color_XYZm15,color_XYZm30,color_XYZm60,color_XYZm240,color_XYZm1440;
if (XYZ_M1 > XYZ_m1) {M1_XYZ= "-";color_XYZm1 = Lime; }
if (XYZ_M1 <= XYZ_m1) {M1_XYZ= "-";color_XYZm1 = Red; }
if (XYZ_M5 > XYZ_m5) {M5_XYZ= "-";color_XYZm5 = Lime; }
if (XYZ_M5 <= XYZ_m5) {M5_XYZ= "-";color_XYZm5 = Red; }
if (XYZ_M15 > XYZ_m15) {M15_XYZ= "-";color_XYZm15 = Lime; }
if (XYZ_M15 <= XYZ_m15) {M15_XYZ= "-";color_XYZm15 = Red; }
if (XYZ_M30 > XYZ_m30) {M30_XYZ= "-";color_XYZm30 = Lime; }
if (XYZ_M30 <= XYZ_m30) {M30_XYZ= "-";color_XYZm30 = Red; }
if (XYZ_H1 > XYZ_h1) {H1_XYZ= "-";color_XYZm60 = Lime; }
if (XYZ_H1 <= XYZ_h1) {H1_XYZ= "-";color_XYZm60 = Red; }
if (XYZ_H4 > XYZ_h4) {H4_XYZ= "-";color_XYZm240 = Lime; }
if (XYZ_H4 <= XYZ_h4) {H4_XYZ= "-";color_XYZm240 = Red; }
if (XYZ_D1 > XYZ_d1) {D1_XYZ= "-";color_XYZm1440 = Lime; }
if (XYZ_D1 <= XYZ_d1) {D1_XYZ= "-";color_XYZm1440 = Red; }
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, 155+Adjust_Side_to_side);
ObjectSet(Obj0002, OBJPROP_YDISTANCE, 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, 130+Adjust_Side_to_side);
ObjectSet(Obj0003, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 110+Adjust_Side_to_side);
ObjectSet(Obj0004, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 90+Adjust_Side_to_side);
ObjectSet(Obj0005, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 70+Adjust_Side_to_side);
ObjectSet(Obj0006, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 50+Adjust_Side_to_side);
ObjectSet(Obj0007, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 30+Adjust_Side_to_side);
ObjectSet(Obj0008, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
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, 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