_TRO_Multi_Meter_MACrossOver
Download scriptThis script functions as a multi-timeframe dashboard, designed to provide traders with a quick visual summary of market trends across several different time periods simultaneously. Instead of requiring you to switch between various charts (like 1-minute, 5-minute, or Daily charts) to see the current momentum, this tool consolidates that information into a single display on your main screen.
How the Logic Works
1. Multi-Timeframe Data Collection The script automatically scans seven different timeframes: M1 (1 minute), M5 (5 minutes), M15 (15 minutes), M30 (30 minutes), H1 (1 hour), H4 (4 hours), and D1 (Daily). For every one of these periods, it calculates two specific "Moving Averages." These averages act as indicators of price direction.
2. Trend Analysis (The Crossover Logic) The core "intelligence" of the script lies in comparing a "Fast" moving average against a "Slow" moving average for each timeframe:
- Bullish Signal: If the Fast average is currently higher than the Slow average, the script identifies this as an upward trend.
- Bearish Signal: If the Fast average is lower than or equal to the Slow average, it identifies a downward trend.
3. Visual Dashboard Representation The script then translates these mathematical comparisons into a color-coded visual display on your chart:
- Green (Lime): Indicates that the trend is currently upward for that specific timeframe.
- Red: Indicates that the trend is currently downward or neutral for that specific timeframe.
User Experience and Interface
- Dashboard Layout: The tool creates a clean set of labels in the corner of your trading chart. It lists the timeframes horizontally so you can see the "big picture" at a glance.
- Dynamic Updates: The script runs continuously, updating the colors instantly as prices move, ensuring that the dashboard always reflects the most current market sentiment across all periods.
- Customization: Users have the ability to adjust the visual placement (shifting the labels up, down, left, or right) and choose whether to display a heading for the different timeframes.
In summary, this tool acts as a "weather report" for the market, showing you simultaneously whether the tide is coming in or going out across multiple horizons, helping you align your short-term trades with the broader long-term trends.
//+------------------------------------------------------------------+
//| _TRO_Multi_Meter_MACrossOver |
//| |
//| 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 = "MAX" ; // change
extern bool Corner_of_Chart_RIGHT_TOP = true;
extern int Shift_UP_DN =30;
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 = "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 ********************
//MAX Signals
double MAX_M1 = iMA(Symbol(),1,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_m1 = iMA(Symbol(),1,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_M5 = iMA(Symbol(),5,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_m5 = iMA(Symbol(),5,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_M15 = iMA(Symbol(),15,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_m15 = iMA(Symbol(),15,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_M30 = iMA(Symbol(),30,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_m30 = iMA(Symbol(),30,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_H1 = iMA(Symbol(),60,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_h1 = iMA(Symbol(),60,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_H4 = iMA(Symbol(),240,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_h4 = iMA(Symbol(),240,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_D1 = iMA(Symbol(),1440,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
double MAX_d1 = iMA(Symbol(),1440,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
// double MAX_W1 = iMA(Symbol(),10080,MA_Fast,0,MA_MODE,MA_PRICE_TYPE,0);
// double MAX_w1 = iMA(Symbol(),10080,MA_Slow,0,MA_MODE,MA_PRICE_TYPE,0);
string M1_MAX= "",M5_MAX= "", M15_MAX= "", M30_MAX= "", H1_MAX= "", H4_MAX= "", D1_MAX= "",PRC1;
color color_MAXm1,color_MAXm5,color_MAXm15,color_MAXm30,color_MAXm60,color_MAXm240,color_MAXm1440;
if (MAX_M1 > MAX_m1) {M1_MAX= "-";color_MAXm1 = Lime; }
if (MAX_M1 <= MAX_m1) {M1_MAX= "-";color_MAXm1 = Red; }
if (MAX_M5 > MAX_m5) {M5_MAX= "-";color_MAXm5 = Lime; }
if (MAX_M5 <= MAX_m5) {M5_MAX= "-";color_MAXm5 = Red; }
if (MAX_M15 > MAX_m15) {M15_MAX= "-";color_MAXm15 = Lime; }
if (MAX_M15 <= MAX_m15) {M15_MAX= "-";color_MAXm15 = Red; }
if (MAX_M30 > MAX_m30) {M30_MAX= "-";color_MAXm30 = Lime; }
if (MAX_M30 <= MAX_m30) {M30_MAX= "-";color_MAXm30 = Red; }
if (MAX_H1 > MAX_h1) {H1_MAX= "-";color_MAXm60 = Lime; }
if (MAX_H1 <= MAX_h1) {H1_MAX= "-";color_MAXm60 = Red; }
if (MAX_H4 > MAX_h4) {H4_MAX= "-";color_MAXm240 = Lime; }
if (MAX_H4 <= MAX_h4) {H4_MAX= "-";color_MAXm240 = Red; }
if (MAX_D1 > MAX_d1) {D1_MAX= "-";color_MAXm1440 = Lime; }
if (MAX_D1 <= MAX_d1) {D1_MAX= "-";color_MAXm1440 = Red; }
Obj0002 = "SignalMAXM1t" + 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 = "SignalMAXM1" + LabelTime ;
ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0003, M1_MAX, 40, "Tahoma Narrow", color_MAXm1);
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 = "SignalMAXM5" + LabelTime ;
ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0004, M5_MAX, 40, "Tahoma Narrow", color_MAXm5);
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 = "SignalMAXM15" + LabelTime ;
ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0005, M15_MAX, 40, "Tahoma Narrow", color_MAXm15);
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 = "SignalMAXM30" + LabelTime ;
ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0006, M30_MAX, 40, "Tahoma Narrow", color_MAXm30);
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 = "SignalMAXM60" + LabelTime ;
ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0007, H1_MAX, 40, "Tahoma Narrow", color_MAXm60);
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 = "SignalMAXM240" + LabelTime ;
ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0008, H4_MAX, 40, "Tahoma Narrow", color_MAXm240);
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 = "SignalMAXM1440" + LabelTime ;
ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Obj0009, D1_MAX, 40, "Tahoma Narrow", color_MAXm1440);
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